mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-25 23:57:49 +00:00
Add bit counter to utils
This commit is contained in:
parent
5a68febdda
commit
56c199fc5d
1 changed files with 8 additions and 0 deletions
|
@ -101,6 +101,14 @@ namespace ASTCC {
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Count the number of bits set in a number.
|
||||||
|
Popcnt(uint32 n) {
|
||||||
|
uint32 c;
|
||||||
|
for(c = 0; n; c++) {
|
||||||
|
n &= n-1;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
} // namespace ASTCC
|
} // namespace ASTCC
|
||||||
|
|
||||||
#endif // ASTCENCODER_SRC_UTILS_H_
|
#endif // ASTCENCODER_SRC_UTILS_H_
|
||||||
|
|
Loading…
Reference in a new issue