Sound font reader TSf
This commit is contained in:
21
source/engine/util.c
Normal file
21
source/engine/util.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "util.h"
|
||||
|
||||
unsigned int powof2(unsigned int num)
|
||||
{
|
||||
if (num != 0) {
|
||||
num--;
|
||||
num |= (num >> 1);
|
||||
num |= (num >> 2);
|
||||
num |= (num >> 4);
|
||||
num |= (num >> 8);
|
||||
num |= (num >> 16);
|
||||
num++;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
int ispow2(int num)
|
||||
{
|
||||
return (num && !(num & (num - 1)));
|
||||
}
|
||||
Reference in New Issue
Block a user