|
Programming Problem - Help
I'm doing somethere where a selected value HAS to be an integer power of 2. Anyone know a "clean" way I could round a desired value to the nearest power of 2?
I.e. input is 37 -> rounded to 32
input is 84 - > rounded to 64
input is 99 -> rounded to 128
Just a general algo is fine, i can adapt it to PHP.
|