Add SWAP for m-shared

This commit is contained in:
Patrick Pelissier committed 2017-03-14 21:43:52 +01:00
1 parent 29d3439900
commit 7118da65ae
1 file changed
+13 -1
+13 -1
View File
@@ -54,7 +54,8 @@
INIT_SET(M_C3(shared_, name, _init_set)), \
SET(M_C3(shared_, name, _set)) \
INIT_MOVE(M_C3(shared_, name, _init_move)), \
MOVE(M_C3(shared_, name, _move)) \
MOVE(M_C3(shared_, name, _move)), \
SWAP(M_C3(shared_, name, _swap)) \
)
#define SHAREDI_PTR_DEF2(name, type, oplist) \
@@ -173,6 +174,17 @@
M_C3(shared_, name, _init_move)(dest, shared); \
} \
\
static inline void \
M_C3(shared_, name, _swap)(M_C3(shared_, name, _t) p1, \
M_C3(shared_, name, _t) p2) \
{ \
SHAREDI_CONTRACT(p1); \
SHAREDI_CONTRACT(p2); \
M_SWAP (struct M_C3(shared_, name, _s)*, *p1, *p2); \
SHAREDI_CONTRACT(p1); \
SHAREDI_CONTRACT(p2); \
} \
\
static inline const type * \
M_C3(shared_, name, _cref)(const M_C3(shared_, name, _t) shared) \
{ \