-
Notifications
You must be signed in to change notification settings - Fork 57
/
stk
58 lines (47 loc) · 826 Bytes
/
stk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
typedef struct B
{
T value[DEQ_BUCKET_SIZE];
int16_t a;
int16_t b;
}
B;
typedef struct A
{
void (*free)(T*);
T (*copy)(T*);
B** pages;
size_t mark_a;
size_t mark_b;
size_t capacity;
size_t size;
}
A;
typedef struct I
{
void (*step)(struct I*);
A* container;
T* ref;
size_t index;
size_t index_next;
size_t index_last;
int done;
}
I;
static inline int
JOIN(A, empty)(A* self)
static inline void
JOIN(A, push)(A* self, T value)
static inline void
JOIN(A, pop)(A* self)
static inline A
JOIN(A, init)(void)
static inline T*
JOIN(A, top)(A* self)
static inline void
JOIN(A, free)(A* self)
static inline void
JOIN(A, swap)(A* self, A* other)
static inline A
JOIN(A, copy)(A* self)
static inline int
JOIN(A, equal)(A* self, A* other, int _equal(T*, T*))