9 // the bottom and top 64-bit values encode
10 // several sub-values, see deque.c
11 typedef struct deque_t {
13 volatile INTPTR bottom;
15 // force bottom and top to different cache lines
16 char buffer[CACHELINESIZE];
22 void dqInit(deque* dq);
23 void dqPushBottom(deque* dq, void* item);
24 void* dqPopTop(deque* dq);
25 void* dqPopBottom(deque* dq);
28 // pop operations may return these values
30 extern void* DQ_POP_EMPTY;
31 extern void* DQ_POP_ABORT;
34 // there are 9 bits for the index into a Node's array,
35 // so 2^9 = 512 elements per node of the deque
36 #define DQNODE_ARRAYSIZE 512
39 typedef struct dequeNode_t {
40 void* itsDataArr[DQNODE_ARRAYSIZE];
41 struct dequeNode_t* next;
42 struct dequeNode_t* prev;
46 static inline int dqDecodeTag(INTPTR E) {
47 return (int) ((0xffffe00000000000 & E) >> 45);
49 static inline dequeNode* dqDecodePtr(INTPTR E) {
50 return (dequeNode*) ((0x00001ffffffffe00 & E) << 3);
52 static inline int dqDecodeIdx(INTPTR E) {
53 return (int) ((0x00000000000001ff & E) );
57 #endif // ___DEQUE_H__