refactor: use popcnt
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
namespace ChatTwo.Util;
|
||||
|
||||
internal static class NumUtil {
|
||||
internal static uint NumberOfSetBits(uint i) {
|
||||
i -= (i >> 1) & 0x55555555;
|
||||
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
|
||||
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user