Generate C code to set coroutine state.

This commit is contained in:
Nigel Tao committed 2017-06-23 15:35:18 +10:00
1 parent bacd2e3b61
commit 8ad82f5e1f
5 files changed
+92 -32

No files matched your search

+5 -3
View File
@@ -9,9 +9,11 @@
// Use switch cases for coroutine state, similar to the technique in
// https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
//
// We use a trivial macro instead of an explicit case statement so that
// clang-format doesn't get confused by the unusual "case"s.
#define PUFFS_COROUTINE_STATE(n) case n:
// We use a trivial macro instead of an explicit assignment and case statement
// so that clang-format doesn't get confused by the unusual "case"s.
#define PUFFS_COROUTINE_STATE(n) \
coro_state = n; \
case n:
#define PUFFS_LOW_BITS(x, n) ((x) & ((1 << (n)) - 1))