OH for crying out loud Here are two no-assembly, portable algorythms i use, first one i came up with, it's based on idea of second algorythm, which is from wikipedia (or the other way round).
Code:if (number and (number - 1) <> 0) // FAST POT CHECK trunc(power(2, trunc(Log2(number)))); // MAKE NUMBER A POT, ROUND UP
Bookmarks