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>2013-08-29 03:49:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-29 03:49:22 +0400
commit260d6cd6b51bc2af39987979378011ee03104b32 (patch)
tree3f93b836c2e022ed4bf2fa9e1d480e0a903bbe22 /source/blender/blenlib/intern/math_base_inline.c
parent1ac57ccbc8b162ffcbede477683d3d53afa209cd (diff)
micro-optimization, avoid checking is_power_of_2_i once in power_of_2_max_i
also whitespace edit.
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 3ffd96f62c7..955a3406cbb 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -131,8 +131,9 @@ MINLINE int power_of_2_max_i(int n)
if (is_power_of_2_i(n))
return n;
- while (!is_power_of_2_i(n))
+ do {
n = n & (n - 1);
+ } while (!is_power_of_2_i(n));
return n * 2;
}