From 8996ee7580ed85b42b6399f9f64e29092ce21c41 Mon Sep 17 00:00:00 2001 From: axtlos Date: Mon, 23 Sep 2024 23:01:51 +0200 Subject: Add cap,min,max functions --- src/extlib.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/extlib.h') diff --git a/src/extlib.h b/src/extlib.h index c62c374..c36b919 100644 --- a/src/extlib.h +++ b/src/extlib.h @@ -67,3 +67,12 @@ char *replace_str (char *s, char *old, char *replace); /// Join an array of strings into one string char *join_str (char **s, size_t len, char delim); + +/// Limit a value to a maximum +float max (float v, float max_v); + +/// Limit a value to a minimum +float min (float v, float min_v); + +/// Limit a value between min and max +float cap (float v, float min_v, float max_v); -- cgit v1.2.3