Export _splice_back methods.

Add _push_move & _pop_move methods for dual push list.
This commit is contained in:
Patrick Pelissier committed 2018-05-27 11:16:16 +02:00
1 parent 53a79e3170
commit 00c5e3544f
2 files changed
+45

No files matched your search

+44
View File
@@ -792,6 +792,22 @@
} \
\
static inline void \
M_C(name, _push_back_move)(list_t v, type *x) \
{ \
assert (x != NULL); \
type *data = M_C(name, _push_back_raw)(v); \
if (M_UNLIKELY (data == NULL)) \
return; \
M_DO_INIT_MOVE (oplist, *data, *x); \
} \
\
static inline void \
M_C(name, _push_move)(list_t v, type *x) \
{ \
M_C(name, _push_move)(v, x); \
} \
\
static inline void \
M_C(name, _pop_back)(type *data, list_t v) \
{ \
LISTI_DUAL_PUSH_CONTRACT(v); \
@@ -811,6 +827,24 @@
LISTI_DUAL_PUSH_CONTRACT(v); \
} \
\
static inline void \
M_C(name, _pop_move)(type *data, list_t v) \
{ \
LISTI_DUAL_PUSH_CONTRACT(v); \
assert (v->back != NULL); \
assert (data != NULL); \
struct M_C(name, _s) *tofree = v->back; \
M_DO_INIT_MOVE (oplist, *data, tofree->data); \
v->back = tofree->next; \
M_C(name,_int_del)(tofree); \
/* Update front too if the list became empty */ \
/* This C code shall generate branchless code */ \
struct M_C(name, _s) *front = v->front; \
front = (front == tofree) ? NULL : front; \
v->front = front; \
LISTI_DUAL_PUSH_CONTRACT(v); \
} \
\
static inline const type * \
M_C(name, _front)(list_t v) \
{ \
@@ -850,6 +884,16 @@
M_GET_INIT_SET oplist(*data, x); \
} \
\
static inline void \
M_C(name, _push_front_move)(list_t v, type *x) \
{ \
assert (x != NULL); \
type *data = M_C(name, _push_front_raw)(v); \
if (M_UNLIKELY (data == NULL)) \
return; \
M_DO_INIT_MOVE (oplist, *data, *x); \
} \
\
static inline type * \
M_C(name, _push_front_new)(list_t v) \
{ \