[Bf-blender-cvs] [f0610563ee5] master: math utils: Add size_t version of min and max functions
Sergey Sharybin
noreply at git.blender.org
Wed Jan 10 11:15:33 CET 2018
Commit: f0610563ee5055a668be9a01f81bfe59b76355b0
Author: Sergey Sharybin
Date: Thu Dec 21 10:39:15 2017 +0100
Branches: master
https://developer.blender.org/rBf0610563ee5055a668be9a01f81bfe59b76355b0
math utils: Add size_t version of min and max functions
===================================================================
M source/blender/blenlib/BLI_math_base.h
M source/blender/blenlib/intern/math_base_inline.c
===================================================================
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.
*
More information about the Bf-blender-cvs
mailing list