From dc87d7e137dbe4d0f7086076a6edadc6659325b1 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Tue, 14 Mar 2017 21:20:52 +0100 Subject: [PATCH] Add M_SWAP macro. --- m-core.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/m-core.h b/m-core.h index 50f7dbfa..dc9e3496 100644 --- a/m-core.h +++ b/m-core.h @@ -555,6 +555,12 @@ /* Is the number a power of 2? (computed in compile time) */ #define M_POWEROF2_P(n) (!((n)&((n)-1))) +/* Swap two types */ +#define M_SWAP(type, x, y) do { \ + type tmp = (x); \ + (x) = (y); \ + (y) = tmp; \ + } while (0) /************************************************************/ /********************* HASH selection ***********************/