ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


new:bits

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
new:bits [2018/02/19 12:28]
korshun
new:bits [2018/02/19 12:29]
korshun
Line 1: Line 1:
 ====== Bit functions ====== ====== Bit functions ======
  
-====== Powers of two ======+These functions are for bit math.
  
-  * ''int npo2(int x)'' -- returns the lowest power of 2 greater or equal to X.+===== Powers of two ===== 
 + 
 +  * ''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''.
  
new/bits.txt · Last modified: 2018/02/19 12:29 by korshun