Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
None
-
None
-
None
-
Reviewed
Description
ReduceTask computes the "closest power of 2" using loops
private static int getClosestPowerOf2(int value) { int power = 0; int approx = 1; while (approx < value) { ++power; approx = (approx << 1); } if ((value - (approx >> 1)) < (approx - value)) { --power; } return power; }
This could be improved.