diff options
| author | WormHeamer | 2026-01-05 19:15:50 -0500 |
|---|---|---|
| committer | WormHeamer | 2026-01-05 19:15:50 -0500 |
| commit | a7fd3c85718286b8513d15dbfd679fcf1ecad2b7 (patch) | |
| tree | b9362af056aa9475e8d1cd1a831edda2a4de30da | |
| parent | 69e6e7753af7e46460813ea160a8226a5847a965 (diff) | |
add MOVE, COPY; fix ASSUME problem
| -rw-r--r-- | wrmr.h | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |
