Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |
| new:bits [2018/02/19 10:28] – korshun | new:bits [2018/02/19 10:29] (current) – korshun |
|---|
| ===== Powers of two ===== | ===== Powers of two ===== |
| |
| * ''int npo2(int x)'' -- returns the lowest power of 2 greater or equal to X. | * ''int npo2(int x)'' -- returns the next lowest power of 2 greater or equal to X. |
| * ''int bitlog2(int x)'' -- returns the index of the highest used bit, aka integer binary logarithm. Useful to convert flags like ''1<<8 = 256'' back into ''8''. | * ''int bitlog2(int x)'' -- returns the index of the highest used bit, aka integer binary logarithm. Useful to convert flags like ''1<<8 = 256'' back into ''8''. |
| |