From 459f18a019b4898417b3277aa436d49e554aa253 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Thu, 4 Jan 2024 09:01:12 +0100 Subject: [PATCH] Fix loop in test_popcount --- Makefile | 4 ++-- test/bitops-test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 87d79f9..52002db 100644 --- a/Makefile +++ b/Makefile @@ -208,7 +208,7 @@ $(SLIB): $(OBJ) | $(LIBDIR) ##################################### tests .PHONY: tests cleanbin cleanbindir -tests: libs $(BIN) +tests: $(BIN) cleanbin: $(call rmfiles,$(TARGET),binary) @@ -216,7 +216,7 @@ cleanbin: cleanbindir: $(call rmdir,$(BINDIR),binaries) -$(BINDIR)/%: $(TESTDIR)/%.c | $(BINDIR) +$(BINDIR)/%: $(TESTDIR)/%.c libs | $(BINDIR) $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -o $@ ##################################### pre-processed (.i) and assembler (.s) output diff --git a/test/bitops-test.c b/test/bitops-test.c index d78b6ad..5603738 100644 --- a/test/bitops-test.c +++ b/test/bitops-test.c @@ -23,14 +23,14 @@ static void test_popcount() u32 t32[] = { 0x0, 0x88000101, 0xffffffff }; 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]); # ifdef ___popcount32_native printf("native:%d ", ___popcount32_native(t32[i])); # endif 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]); # ifdef ___popcount64_native printf("native:%d ", ___popcount64_native(t64[i]));