From d623c6c85071b9af5d607bb5d9aceceaea05220a Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 23 Dec 2022 23:55:10 +0100 Subject: Experimental uppercase macros. --- misc/examples/birthday.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'misc/examples/birthday.c') diff --git a/misc/examples/birthday.c b/misc/examples/birthday.c index 48b8ceaa..be7f0457 100644 --- a/misc/examples/birthday.c +++ b/misc/examples/birthday.c @@ -18,10 +18,10 @@ static void test_repeats(void) printf("birthday paradox: value range: 2^%d, testing repeats of 2^%d values\n", BITS, BITS_TEST); stc64_t rng = stc64_new(seed); - c_auto (cmap_ic, m) + c_AUTO (cmap_ic, m) { cmap_ic_reserve(&m, N); - c_forrange (i, N) { + c_FORRANGE (i, N) { uint64_t k = stc64_rand(&rng) & mask; int v = cmap_ic_insert(&m, k, 0).ref->second += 1; if (v > 1) printf("repeated value %" PRIu64 " (%d) at 2^%d\n", @@ -42,17 +42,17 @@ void test_distribution(void) stc64_t rng = stc64_new(seed); const size_t N = 1ull << BITS ; - c_auto (cmap_x, map) { - c_forrange (N) { + c_AUTO (cmap_x, map) { + c_FORRANGE (N) { uint64_t k = stc64_rand(&rng); cmap_x_insert(&map, k & 0xf, 0).ref->second += 1; } uint64_t sum = 0; - c_foreach (i, cmap_x, map) sum += i.ref->second; + c_FOREACH (i, cmap_x, map) sum += i.ref->second; sum /= map.size; - c_foreach (i, cmap_x, map) { + c_FOREACH (i, cmap_x, map) { printf("%4" PRIu32 ": %" PRIu64 " - %" PRIu64 ": %11.8f\n", i.ref->first, i.ref->second, sum, (1 - (double)i.ref->second / sum)); -- cgit v1.2.3