diff options
author | Bastien Montagne <bastien@blender.org> | 2020-04-14 12:29:10 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-04-14 12:29:46 +0300 |
commit | 6e272b9ba429dc7f4fc7724f19254b1021a9559b (patch) | |
tree | 8395a317e3bb985af0bddd0347c6bc7550f1f307 | |
parent | 47084bac9f3c4c95b6fa3e3c3d5b1e661b2bec47 (diff) |
BLI_math: add min/max utils for chars.
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 7a9d17d2b05..ae9617d2f16 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -151,6 +151,9 @@ MINLINE int max_iiii(int a, int b, int c, int d); MINLINE size_t min_zz(size_t a, size_t b); MINLINE size_t max_zz(size_t a, size_t b); +MINLINE char min_cc(char a, char b); +MINLINE char max_cc(char a, char b); + MINLINE int clamp_i(int value, int min, int max); MINLINE float clamp_f(float value, float min, float max); MINLINE size_t clamp_z(size_t value, size_t min, size_t max); diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index c4b68e9164c..e0cac508d28 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -524,6 +524,15 @@ MINLINE size_t max_zz(size_t a, size_t b) return (b < a) ? a : b; } +MINLINE char min_cc(char a, char b) +{ + return (a < b) ? a : b; +} +MINLINE char max_cc(char a, char b) +{ + return (b < a) ? a : b; +} + MINLINE int clamp_i(int value, int min, int max) { return min_ii(max_ii(value, min), max); |