Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 2067d1d7 authored by Jens Gustedt's avatar Jens Gustedt
Browse files

integrate the setting of the future value into the state initialization

parent 2d82fe50
......@@ -71,9 +71,8 @@ P00_DOCUMENT_PERMITTED_ARGUMENT(P99_LIFO_PUSH, 1)
p99_extension \
({ \
register const P99_MACRO_VAR(p00_l, (L)); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp); \
register __typeof__(p00_l->p00_dum) p00_rr = (EL); \
p99_tp_state_set(&p00_state, p00_rr); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp, p00_rr); \
do { \
p00_rr->p99_lifo = p99_tp_state_get(&p00_state); \
} while (!p99_tp_state_commit(&p00_state)); \
......@@ -124,7 +123,7 @@ P00_DOCUMENT_PERMITTED_ARGUMENT(P99_LIFO_POP, 0)
p99_extension \
({ \
register const P99_MACRO_VAR(p00_l, (L)); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp, 0); \
/* be sure that the result can not be used as an lvalue */ \
register __typeof__(p00_l->p00_dum) p00_r = p99_tp_state_get(&p00_state); \
for (; p00_r; p00_r = p99_tp_state_get(&p00_state)) { \
......@@ -165,8 +164,7 @@ P00_DOCUMENT_PERMITTED_ARGUMENT(P99_LIFO_CLEAR, 0)
p99_extension \
({ \
register const P99_MACRO_VAR(p00_l, (L)); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp); \
p99_tp_state_set(&p00_state, 0); \
p99_tp_state p00_state = p99_tp_state_initializer(&(p00_l)->p00_tp, 0); \
/* be sure that the result can not be used as an lvalue */ \
register __typeof__(p00_l->p00_dum) p00_r = p99_tp_state_get(&p00_state); \
for (; p00_r; p00_r = p99_tp_state_get(&p00_state)) { \
......
......@@ -62,10 +62,17 @@ p00_tp_uint p00_tp_get(p99_tp* p00_tp) {
}
p99_inline
p99_tp_state p99_tp_state_initializer(p99_tp* p00_tp) {
p00_tp_uint p00_tp_p2i(void * p, p00_tp_uint t) {
return (t<<p00_tp_shift)|(uintptr_t)p;
}
p99_inline
p99_tp_state p99_tp_state_initializer(p99_tp* p00_tp, void* p00_p) {
uintptr_t p00_tic = atomic_fetch_add(&p00_tp->p00_tic, UINTPTR_C(1));
return (p99_tp_state) {
.p00_val = p00_tp_get(p00_tp),
.p00_tic = atomic_fetch_add(&p00_tp->p00_tic, UINTPTR_C(1)),
.p00_next = (p00_p ? p00_tp_p2i(p00_p, p00_tic) : 0),
.p00_tic = p00_tic,
.p00_tp = p00_tp,
};
}
......@@ -85,11 +92,6 @@ void * p99_tp_get(p99_tp* p00_tp) {
return p00_tp_i2p(p00_tp_get(p00_tp));
}
p99_inline
p00_tp_uint p00_tp_p2i(void * p, p00_tp_uint t) {
return (t<<p00_tp_shift)|(uintptr_t)p;
}
p99_inline
void p99_tp_state_set(p99_tp_state* p00_state, void* p00_p) {
p00_state->p00_next = p00_tp_p2i(p00_p, p00_state->p00_tic);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment