commit 2e6422c76308d22e293d2f3a3de0733d7447805e
parent 66434a97cb02264eb569fa3c25c845e2150d2bc6
Author: Robert Russell <robertrussell.72001@gmail.com>
Date: Sat, 6 Jul 2024 17:58:18 -0700
Add SET macro for assigning arrays
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/inc/def.h b/inc/def.h
@@ -33,6 +33,8 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define SET(a, v) do { memcpy(&(a), (v), sizeof(a)); } while (0)
+
#define SWAP(a, b) do { \
/* The check in the array size is basically a portable static_assert.
* The isize cast is necessary; without it, -1 becomes unsigned. */ \