diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-23 08:28:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-23 08:28:05 +0300 |
commit | fb7d23bdb2a5c0ed00067045e4acdf6593258b52 (patch) | |
tree | 227357a88bf78ff5596c3217e4454ca856427519 /source/blender/blenlib | |
parent | 100ffd3c0f9ec9ea4536f3428a5e8ed512f24b1c (diff) | |
parent | 434ed96dd2aafe787d17925b929b12774cea2c62 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index ec6042637aa..8f8d7cc3b7f 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -140,24 +140,15 @@ extern "C" { /* some math and copy defines */ -#define _VA_SWAP3(type, a, b) { \ - CHECK_TYPE(a, type); \ - CHECK_TYPE(b, type); \ - type SWAP = (a); \ - (a) = (b); \ - (b) = SWAP; \ -} (void)0 - -#define _VA_SWAP2(a, b) { \ - CHECK_TYPE_PAIR(a, b); \ - struct { char a_[sizeof(a)]; } SWAP, *a_ = (void *)&(a), *b_ = (void *)&(b); \ - SWAP = *a_; \ - *a_ = *b_; \ - *b_ = SWAP; \ -} ((void)0) -/* SWAP with two or three args (initial type argument is optional) */ -#define SWAP(...) VA_NARGS_CALL_OVERLOAD(_VA_SWAP, __VA_ARGS__) +#define SWAP(type, a, b) { \ + type sw_ap; \ + CHECK_TYPE(a, type); \ + CHECK_TYPE(b, type); \ + sw_ap = (a); \ + (a) = (b); \ + (b) = sw_ap; \ +} (void)0 /* swap with a temp value */ #define SWAP_TVAL(tval, a, b) { \ |