From da8619fe23d22a5009868302bac05d965adb76ac Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Jan 2014 12:31:30 +1100 Subject: Math Lib: add iroundf function for: (int)floorf(a + 0.5f) --- source/blender/blenlib/intern/math_base_inline.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenlib/intern/math_base_inline.c') 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) -- cgit v1.2.3