diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2020-05-24 11:44:59 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2020-05-24 11:44:59 -0400 |
commit | c6fc66a10eb15570050002a06c31b7a7864ffd70 (patch) | |
tree | 66a15ef0a285d93e8f9d6413a05ee0459d755edd /arm9/lib/src/MATH_pop.c | |
parent | 5246bfac368c6c59314ee6cbf95020c48beb6a51 (diff) | |
parent | b4743f04e30937b19aca974bf2222de8fe3eb36e (diff) |
Merge branch 'pikalax_work' of github.com:PikalaxALT/pokediamond into pikalax_work
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; +} |