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:
authorCampbell Barton <ideasman42@gmail.com>2014-01-15 05:31:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-15 06:40:40 +0400
commitda8619fe23d22a5009868302bac05d965adb76ac (patch)
tree2bb47412febb179e51d45d60e32d5b6bf93d4bbd /source/blender/blenlib/intern/math_base_inline.c
parent9e8428b09ab60111a2160722c7910144646646be (diff)
Math Lib: add iroundf function for: (int)floorf(a + 0.5f)
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index a215d99e32d..facc7150ab8 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -151,6 +151,11 @@ MINLINE int power_of_2_min_i(int n)
return n;
}
+MINLINE int iroundf(float a)
+{
+ return (int)floorf(a + 0.5f);
+}
+
/* integer division that rounds 0.5 up, particularly useful for color blending
* with integers, to avoid gradual darkening when rounding down */
MINLINE int divide_round_i(int a, int b)