mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-08 06:35:33 +00:00
Add bit counter to utils
This commit is contained in:
parent
5a68febdda
commit
56c199fc5d
|
@ -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