summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2026-01-05 19:15:50 -0500
committerWormHeamer2026-01-05 19:15:50 -0500
commita7fd3c85718286b8513d15dbfd679fcf1ecad2b7 (patch)
treeb9362af056aa9475e8d1cd1a831edda2a4de30da
parent69e6e7753af7e46460813ea160a8226a5847a965 (diff)
add MOVE, COPY; fix ASSUME problem
-rw-r--r--wrmr.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/wrmr.h b/wrmr.h
index 67523ec..3e80598 100644
--- a/wrmr.h
+++ b/wrmr.h
@@ -76,14 +76,15 @@ typedef uintptr_t uptr;
#define UNREACHABLE UNREACHABLE_MSG("unreachable code")
+#define ASSUME(...) do if (!(__VA_ARGS__)) UNREACHABLE_MSG("assumption failed: " #__VA_ARGS__); while(0)
#ifdef NDEBUG
# if defined(_MSC_VER)
+# undef ASSUME
# define ASSUME(...) (__assume(__VA_ARGS__))
# elif HAS_BUILTIN(__builtin_assume)
+# undef ASSUME
# define ASSUME(...) (__builtin_assume(__VA_ARGS__))
# endif
-#else
-# define ASSUME(...) do if (!(__VA_ARGS__)) UNREACHABLE_MSG("assumption failed: " #__VA_ARGS__); while(0)
#endif
#if __STDC_VERSION__ >= 202311L
@@ -93,5 +94,7 @@ typedef uintptr_t uptr;
#endif
#define COUNTOF(x) (sizeof(x) / sizeof(*(x)))
+#define MOVE(a0, a1, n) memmove(1?(a0):(a1), a1, sizeof(*(a0)) * (n));
+#define COPY(a0, a1, n) memmove(1?(a0):(a1), a1, sizeof(*(a0)) * (n));
#endif