Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-21 12:39:15 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-10 13:06:44 +0300
commitf0610563ee5055a668be9a01f81bfe59b76355b0 (patch)
tree5d2d551a6d1465654cf523b3f6c7c2ec75032003 /source/blender/blenlib
parent18f53d8822518928baceab1407eac195ab9bf817 (diff)
math utils: Add size_t version of min and max functions
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_base.h3
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c9
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 e6a72298ae7..cb3dc960042 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -129,6 +129,9 @@ MINLINE int max_iii(int a, int b, int c);
MINLINE int min_iiii(int a, int b, int c, int d);
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 int compare_ff(float a, float b, const float max_diff);
MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps);
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 749c18fc0ce..9202efce7b4 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -315,6 +315,15 @@ MINLINE int max_iiii(int a, int b, int c, int d)
return max_ii(max_iii(a, b, c), d);
}
+MINLINE size_t min_zz(size_t a, size_t b)
+{
+ return (a < b) ? a : b;
+}
+MINLINE size_t max_zz(size_t a, size_t b)
+{
+ return (b < a) ? a : b;
+}
+
/**
* Almost-equal for IEEE floats, using absolute difference method.
*