forked from mirrors/qmk_userspace
new build method for macway
This commit is contained in:
parent
461e0d3d8c
commit
2f80e790c6
17 changed files with 432 additions and 227 deletions
18
util.c
Normal file
18
util.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "util.h"
|
||||
|
||||
int bitpop(uint8_t bits)
|
||||
{
|
||||
int c;
|
||||
for (c = 0; bits; c++)
|
||||
bits &= bits -1;
|
||||
return c;
|
||||
}
|
||||
|
||||
int biton(uint8_t bits)
|
||||
{
|
||||
int n = 0;
|
||||
if (bits >> 4) { bits >>= 4; n += 4;}
|
||||
if (bits >> 2) { bits >>= 2; n += 2;}
|
||||
if (bits >> 1) { bits >>= 1; n += 1;}
|
||||
return n;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue