micro-optimization, avoid checking is_power_of_2_i once in power_of_2_max_i

also whitespace edit.
This commit is contained in:
Campbell Barton 2013-08-28 23:49:22 +00:00
parent 1ac57ccbc8
commit 260d6cd6b5
2 changed files with 3 additions and 2 deletions

@ -131,8 +131,9 @@ MINLINE int power_of_2_max_i(int n)
if (is_power_of_2_i(n)) if (is_power_of_2_i(n))
return n; return n;
while (!is_power_of_2_i(n)) do {
n = n & (n - 1); n = n & (n - 1);
} while (!is_power_of_2_i(n));
return n * 2; return n * 2;
} }