diff options
author | Revo <projectrevotpp@hotmail.com> | 2020-05-23 07:23:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-23 07:23:16 -0400 |
commit | 0b01c7d1c57c4e21fdb0069b3ac4f9c7276b3cc1 (patch) | |
tree | 2f30c7bd3c7300bba75a1738b08faa16de57cea2 /arm9/lib/src/MATH_pop.c | |
parent | 79a7e3dac84f719ca4d0131ac2e30e2c6a4bd73e (diff) | |
parent | 936ea8a0134ed8095f9496ebe1571866509530d7 (diff) |
Merge pull request #104 from Cleverking2003/master
Decompile libmath
Diffstat (limited to 'arm9/lib/src/MATH_pop.c')
-rw-r--r-- | arm9/lib/src/MATH_pop.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arm9/lib/src/MATH_pop.c b/arm9/lib/src/MATH_pop.c new file mode 100644 index 00000000..18582494 --- /dev/null +++ b/arm9/lib/src/MATH_pop.c @@ -0,0 +1,12 @@ +#include "global.h" +#include "MATH_pop.h" + +ARM_FUNC u8 MATH_CountPopulation(u32 x) { + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x += x >> 4; + x &= 0x0f0f0f0f; + x += x >> 8; + x += x >> 16; + return (u8)x; +} |