mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 06:45:10 +00:00
Back out he XOR swap trick, it is slower than a temp variable on
modern CPUs.
This commit is contained in:
7
parse.h
7
parse.h
@@ -146,13 +146,12 @@ struct defaults {
|
|||||||
/*
|
/*
|
||||||
* Append one queue (or single entry) to another using the
|
* Append one queue (or single entry) to another using the
|
||||||
* circular properties of the prev pointer to simplify the logic.
|
* circular properties of the prev pointer to simplify the logic.
|
||||||
* We use XOR to swap the two prev pointers to avoid a temp variable.
|
|
||||||
*/
|
*/
|
||||||
#define LIST_APPEND(h, e) do { \
|
#define LIST_APPEND(h, e) do { \
|
||||||
|
void *_tail = (e)->prev; \
|
||||||
(h)->prev->next = (e); \
|
(h)->prev->next = (e); \
|
||||||
(long)(e)->prev ^= (long)(h)->prev; \
|
(e)->prev = (h)->prev; \
|
||||||
(long)(h)->prev ^= (long)(e)->prev; \
|
(h)->prev = _tail; \
|
||||||
(long)(e)->prev ^= (long)(h)->prev; \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user