diff options
author | axtlos <axtlos@disroot.org> | 2024-09-23 23:01:51 +0200 |
---|---|---|
committer | axtlos <axtlos@disroot.org> | 2024-09-23 23:01:51 +0200 |
commit | 8996ee7580ed85b42b6399f9f64e29092ce21c41 (patch) | |
tree | 3cec945364e91e6504edf9a6c533fa104a0d3f34 /src/extlib.h | |
parent | d9aeb51683449ef79339c9ca3c80059c17dec599 (diff) | |
download | extlib-8996ee7580ed85b42b6399f9f64e29092ce21c41.tar.gz extlib-8996ee7580ed85b42b6399f9f64e29092ce21c41.tar.bz2 |
Add cap,min,max functions
Diffstat (limited to 'src/extlib.h')
-rw-r--r-- | src/extlib.h | 9 |
1 files changed, 9 insertions, 0 deletions
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); |