mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
Add a PUFFS_COROUTINE_STATE macro.
This commit is contained in:
1 parent
24c8509242
commit
bacd2e3b61
4 files changed
+363
-345
No files matched your search
@@ -3,6 +3,16 @@
|
||||
#ifndef PUFFS_BASE_IMPL_H
|
||||
#define PUFFS_BASE_IMPL_H
|
||||
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
// 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:
|
||||
|
||||
#define PUFFS_LOW_BITS(x, n) ((x) & ((1 << (n)) - 1))
|
||||
|
||||
#endif // PUFFS_BASE_IMPL_H
|
||||
Reference in new issue
Block a user