diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-09-10 22:12:22 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-09-10 22:12:22 +0200 |
| commit | 32e14551a90e85000e41b3f0445d34d58a1431e4 (patch) | |
| tree | 912c1e50b93b501446b1b179ee2a3e93586fb854 /src/check.hh | |
| parent | cf99d0c865474105c14b2348fdbd1c83d87d5a29 (diff) | |
Add unicode general category lookup
Generate the lookup tables from UnicodeData.txt, do to that,
add gen_ugc, which uses csv, buffers, line, io and other modules
to do the job.
Diffstat (limited to 'src/check.hh')
| -rw-r--r-- | src/check.hh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/check.hh b/src/check.hh new file mode 100644 index 0000000..be65437 --- /dev/null +++ b/src/check.hh @@ -0,0 +1,39 @@ +#ifndef CHECK_HH +#define CHECK_HH + +#include <cstdlib> +#include <stdckdint.h> +#include <type_traits> + +namespace check { + +template<typename T> +requires std::is_arithmetic_v<T> +T add(T a, T b) { + T ret; + if (ckd_add(&ret, a, b)) + abort(); + return ret; +} + +template<typename T> +requires std::is_arithmetic_v<T> +T sub(T a, T b) { + T ret; + if (ckd_sub(&ret, a, b)) + abort(); + return ret; +} + +template<typename T> +requires std::is_arithmetic_v<T> +T mul(T a, T b) { + T ret; + if (ckd_mul(&ret, a, b)) + abort(); + return ret; +} + +} // namespace check + +#endif // CHECK_HH |
