tbm-mcu/source/bitops.c

11 lines
112 B
C

#include <bitops.h>
unsigned ilog2(unsigned n)
{
unsigned ret = 0;
while (n >>= 1)
++ret;
return ret;
}