Use GCC popcount intrinsic for popcount
Jeffrey Pfau jeffrey@endrift.com
Tue, 21 Oct 2014 22:51:39 -0700
1 files changed,
2 insertions(+),
10 deletions(-)
jump to
M
src/gba/gba-memory.c
→
src/gba/gba-memory.c
@@ -571,11 +571,7 @@ int offset = 4;
int popcount = 0; if (direction & LSM_D) { offset = -4; - for (i = 0; i < 16; ++i) { - if (mask & (1 << i)) { - ++popcount; - } - } + popcount = __builtin_popcount(mask); address -= (popcount << 2) - 4; }@@ -678,11 +674,7 @@ int offset = 4;
int popcount = 0; if (direction & LSM_D) { offset = -4; - for (i = 0; i < 16; ++i) { - if (mask & (1 << i)) { - ++popcount; - } - } + popcount = __builtin_popcount(mask); address -= (popcount << 2) - 4; }