summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-06-08 06:55:42 +0200
committerTyge Lovset <[email protected]>2023-06-08 06:55:42 +0200
commitabd3b4372dee2291a81271f02588228279139960 (patch)
treeb60b14a94e2c7f676ffe152174e6ba237e731e20 /misc/examples
parent2bac1dff09459ce55f6e6813af96f845a8c981a1 (diff)
downloadSTC-modified-abd3b4372dee2291a81271f02588228279139960.tar.gz
STC-modified-abd3b4372dee2291a81271f02588228279139960.zip
More small adjustments.
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/triples.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/misc/examples/triples.c b/misc/examples/triples.c
index 06142916..17e3d40b 100644
--- a/misc/examples/triples.c
+++ b/misc/examples/triples.c
@@ -32,7 +32,7 @@ struct triples {
int cco_state;
};
-bool triples_coro(struct triples* t) {
+void triples_coro(struct triples* t) {
cco_routine(t) {
t->count = 0;
for (t->c = 5; t->size; ++t->c) {
@@ -41,15 +41,14 @@ bool triples_coro(struct triples* t) {
if ((int64_t)t->a*t->a + (int64_t)t->b*t->b == (int64_t)t->c*t->c) {
if (t->count++ == t->size)
cco_return;
- cco_yield(false);
+ cco_yield();
}
}
}
}
- cco_final:
+ cco_final:
puts("done");
}
- return true;
}
int main()
@@ -61,7 +60,8 @@ int main()
struct triples t = {INT32_MAX};
int n = 0;
- while (!triples_coro(&t)) {
+ while (!cco_done(&t)) {
+ triples_coro(&t);
if (gcd(t.a, t.b) > 1)
continue;
if (t.c < 100)