Use GCC popcount intrinsic for popcount

This commit is contained in:
Jeffrey Pfau 2014-10-21 22:51:39 -07:00
parent 537480b940
commit 9abe700d37
1 changed files with 2 additions and 10 deletions

View File

@ -571,11 +571,7 @@ uint32_t GBALoadMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum L
int popcount = 0; int popcount = 0;
if (direction & LSM_D) { if (direction & LSM_D) {
offset = -4; offset = -4;
for (i = 0; i < 16; ++i) { popcount = __builtin_popcount(mask);
if (mask & (1 << i)) {
++popcount;
}
}
address -= (popcount << 2) - 4; address -= (popcount << 2) - 4;
} }
@ -678,11 +674,7 @@ uint32_t GBAStoreMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum
int popcount = 0; int popcount = 0;
if (direction & LSM_D) { if (direction & LSM_D) {
offset = -4; offset = -4;
for (i = 0; i < 16; ++i) { popcount = __builtin_popcount(mask);
if (mask & (1 << i)) {
++popcount;
}
}
address -= (popcount << 2) - 4; address -= (popcount << 2) - 4;
} }