Fix loop in test_popcount

This commit is contained in:
2024-01-04 09:01:12 +01:00
parent 0dcca10559
commit 459f18a019
2 changed files with 4 additions and 4 deletions

View File

@@ -208,7 +208,7 @@ $(SLIB): $(OBJ) | $(LIBDIR)
##################################### tests ##################################### tests
.PHONY: tests cleanbin cleanbindir .PHONY: tests cleanbin cleanbindir
tests: libs $(BIN) tests: $(BIN)
cleanbin: cleanbin:
$(call rmfiles,$(TARGET),binary) $(call rmfiles,$(TARGET),binary)
@@ -216,7 +216,7 @@ cleanbin:
cleanbindir: cleanbindir:
$(call rmdir,$(BINDIR),binaries) $(call rmdir,$(BINDIR),binaries)
$(BINDIR)/%: $(TESTDIR)/%.c | $(BINDIR) $(BINDIR)/%: $(TESTDIR)/%.c libs | $(BINDIR)
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -o $@ $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -o $@
##################################### pre-processed (.i) and assembler (.s) output ##################################### pre-processed (.i) and assembler (.s) output

View File

@@ -23,14 +23,14 @@ static void test_popcount()
u32 t32[] = { 0x0, 0x88000101, 0xffffffff }; u32 t32[] = { 0x0, 0x88000101, 0xffffffff };
u64 t64[] = { 0x0ll, 0x8880000000000101LL, 0xffffffffffffffffll }; u64 t64[] = { 0x0ll, 0x8880000000000101LL, 0xffffffffffffffffll };
for (uint i = 0; i < sizeof(t32); ++i) { for (uint i = 0; i < ARRAY_SIZE(t32); ++i) {
printf("popcount 32 (%#x): ", t32[i]); printf("popcount 32 (%#x): ", t32[i]);
# ifdef ___popcount32_native # ifdef ___popcount32_native
printf("native:%d ", ___popcount32_native(t32[i])); printf("native:%d ", ___popcount32_native(t32[i]));
# endif # endif
printf("emulated:%d\n", ___popcount_emulated(t32[i])); printf("emulated:%d\n", ___popcount_emulated(t32[i]));
} }
for (uint i = 0; i < sizeof(t64); ++i) { for (uint i = 0; i < ARRAY_SIZE(t64); ++i) {
printf("popcount 64 (%#lx): ", t64[i]); printf("popcount 64 (%#lx): ", t64[i]);
# ifdef ___popcount64_native # ifdef ___popcount64_native
printf("native:%d ", ___popcount64_native(t64[i])); printf("native:%d ", ___popcount64_native(t64[i]));