aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/clib.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2024-09-25 15:52:16 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-09-25 20:05:45 +0000
commitea4a5499ae28818c7fa9be006f46c4701e38ce92 (patch)
tree7fdfdd65053a8233200d5538f2c69fb30173231b /src/vppinfra/clib.h
parent4089d7cf1b6eae3147a4088b76fbc246b7affb36 (diff)
vppinfra: add CLIB_SWAP()
Type: improvement Change-Id: I1911a9d6a0ca8e1d24ce7b95281886392081ffc6 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r--src/vppinfra/clib.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index 75cebc65672..5348738ec6a 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -106,6 +106,13 @@
#define CLIB_STRING_ARRAY(...) \
(char *[]) { __VA_ARGS__, 0 }
+#define CLIB_SWAP(a, b) \
+ { \
+ typeof (a) __tmp = a; \
+ a = b; \
+ b = __tmp; \
+ }
+
/* sanitizers */
#ifdef __has_feature
#if __has_feature(address_sanitizer)