summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-24 19:47:16 +0200
committerTyge Løvset <[email protected]>2023-05-24 19:47:16 +0200
commitc3e01470f45f19215fac339302d87b5d73a323e8 (patch)
treea573d484fafc4bee8503c4af7eee1b61ab098010 /misc
parent276b8110033aa275f58ce60d096f220ca050738c (diff)
downloadSTC-modified-c3e01470f45f19215fac339302d87b5d73a323e8.tar.gz
STC-modified-c3e01470f45f19215fac339302d87b5d73a323e8.zip
More coro adjustments.
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/examples/make.sh17
-rw-r--r--misc/examples/prime.c4
2 files changed, 10 insertions, 11 deletions
diff --git a/misc/examples/make.sh b/misc/examples/make.sh
index 5c81c4d3..d58ed0cb 100755
--- a/misc/examples/make.sh
+++ b/misc/examples/make.sh
@@ -6,15 +6,14 @@ if [ "$(uname)" = 'Linux' ]; then
oflag='-o '
fi
-cc=gcc; cflags="-DSTC_STATIC -s -O3 -std=c99 -Wall -Wextra -Wpedantic -Wconversion -Wwrite-strings -Wdouble-promotion -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-missing-field-initializers"
-#cc=gcc; cflags="-DSTC_STATIC -g -std=c99 -Werror -Wfatal-errors -Wpedantic -Wall $sanitize"
-#cc=tcc; cflags="-DSTC_STATIC -Wall -std=c99"
-#cc=clang; cflags="-DSTC_STATIC -s -O3 -std=c99 -Wall -Wextra -Wpedantic -Wconversion -Wwrite-strings -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-implicit-fallthrough -Wno-missing-field-initializers"
-#cc=gcc; cflags="-DSTC_STATIC -x c++ -s -O2 -Wall -std=c++20"
-#cc=g++; cflags="-DSTC_STATIC -x c++ -s -O2 -Wall"
-#cc=cl; cflags="-DSTC_STATIC -O2 -nologo -W3 -MD"
-#cc=cl; cflags="-DSTC_STATIC -nologo -TP"
-#cc=cl; cflags="-DSTC_STATIC -nologo -std:c11"
+cc=gcc; cflags="-DSTC_STATIC -std=c99 -s -O3 -Wall -Wextra -Wpedantic -Wconversion -Wwrite-strings -Wdouble-promotion -Wno-unused-parameter -Wno-maybe-uninitialized -Wno-implicit-fallthrough -Wno-missing-field-initializers"
+#cc=gcc; cflags="-DSTC_STATIC -std=c99 -g -Werror -Wfatal-errors -Wpedantic -Wall $sanitize"
+#cc=tcc; cflags="-DSTC_STATIC -std=c99 -Wall"
+#cc=clang; cflags="-DSTC_STATIC -std=c99 -s -O3 -Wall -Wextra -Wpedantic -Wconversion -Wwrite-strings -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-implicit-fallthrough -Wno-missing-field-initializers"
+#cc=gcc; cflags="-DSTC_STATIC -x c++ -std=c++20 -O2 -s -Wall"
+#cc=cl; cflags="-DSTC_STATIC -nologo -O2 -MD -W3 -wd4003"
+#cc=cl; cflags="-DSTC_STATIC -nologo -TP -wd4003"
+#cc=cl; cflags="-DSTC_STATIC -nologo -std:c11 -wd4003"
if [ "$cc" = "cl" ]; then
oflag='/Fe:'
diff --git a/misc/examples/prime.c b/misc/examples/prime.c
index 7efa26ff..cb0f8926 100644
--- a/misc/examples/prime.c
+++ b/misc/examples/prime.c
@@ -32,9 +32,8 @@ int main(void)
clock_t t = clock();
cbits primes = sieveOfEratosthenes(n + 1);
int np = (int)cbits_count(&primes);
- t = t - clock();
+ t = clock() - t;
- printf("Number of primes: %d, time: %f\n\n", np, (double)t/CLOCKS_PER_SEC);
puts("Show all the primes in the range [2, 1000):");
printf("2");
c_forrange (i, 3, 1000, 2)
@@ -49,6 +48,7 @@ int main(void)
printf("%lld ", *i.ref);
if (c_flt_getcount(i) % 10 == 0) puts("");
}
+ printf("Number of primes: %d, time: %.2f\n\n", np, (double)t/CLOCKS_PER_SEC);
cbits_drop(&primes);
}