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:
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index f68970b832d..e6509db1c5e 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -153,9 +153,12 @@ MINLINE int divide_round_i(int a, int b)
return (2 * a + b) / (2 * b);
}
-MINLINE int positive_mod(int i, int n)
+/**
+ * modulo that handles negative numbers, works the same as Python's.
+ */
+MINLINE int mod_i(int i, int n)
{
- return ((i = i % n) < 0) ? i + n : i;
+ return (i % n + n) % n;
}
MINLINE unsigned int highest_order_bit_i(unsigned int n)