diff options
author | red031000 <rubenru09@aol.com> | 2020-05-23 22:15:15 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-05-23 22:15:15 +0100 |
commit | 28ee4d7c35fc0f793b9ac0f1d6cee8e3bba59667 (patch) | |
tree | 5c493c38c5418c38c4ab7cd6cf3168813a66b3d5 /arm9/lib/src/MATH_pop.c | |
parent | 565fa0f53aaa22e30d5566e7c8bed1ac912f78ba (diff) | |
parent | 0b01c7d1c57c4e21fdb0069b3ac4f9c7276b3cc1 (diff) |
Merge branch 'master' of https://github.com/martmists/pokediamond
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; +} |