diff options
| author | Tyge Løvset <[email protected]> | 2023-02-08 16:16:49 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-08 17:18:24 +0100 |
| commit | c4441f5fc665194fbd7a894a67a64a08c3beac42 (patch) | |
| tree | 82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/examples/prime.c | |
| parent | 673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff) | |
| download | STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip | |
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/examples/prime.c')
| -rw-r--r-- | misc/examples/prime.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/misc/examples/prime.c b/misc/examples/prime.c index 11c1f1c7..4a3b8498 100644 --- a/misc/examples/prime.c +++ b/misc/examples/prime.c @@ -30,7 +30,7 @@ int main(void) printf("computing prime numbers up to %" c_ZI "\n", n); clock_t t1 = clock(); - c_WITH (cbits primes = sieveOfEratosthenes(n + 1), cbits_drop(&primes)) { + c_with (cbits primes = sieveOfEratosthenes(n + 1), cbits_drop(&primes)) { puts("done"); intptr_t np = cbits_count(&primes); clock_t t2 = clock(); @@ -38,13 +38,13 @@ int main(void) printf("number of primes: %" c_ZI ", time: %f\n", np, (float)(t2 - t1) / (float)CLOCKS_PER_SEC); puts("Show all the primes in the range [2, 1000):"); printf("2"); - c_FORRANGE (i, 3, 1000, 2) + c_forrange (i, 3, 1000, 2) if (cbits_test(&primes, i>>1)) printf(" %lld", i); puts(""); puts("Show the last 50 primes using a temporary crange generator:"); crange R = crange_make(n - 1, 0, -2); - c_FORFILTER (i, crange, R + c_forfilter (i, crange, R , cbits_test(&primes, *i.ref>>1) , c_flt_take(i, 50)) { printf("%lld ", *i.ref); |
