30 #include "cx/utils.h" |
30 #include "cx/utils.h" |
31 #include <stdint.h> |
31 #include <stdint.h> |
32 #include <string.h> |
32 #include <string.h> |
33 #include <assert.h> |
33 #include <assert.h> |
34 |
34 |
35 /* LOW LEVEL LINKED LIST FUNCTIONS */ |
35 // LOW LEVEL LINKED LIST FUNCTIONS |
36 |
36 |
37 #define CX_LL_PTR(cur, off) (*(void**)(((char*)(cur))+(off))) |
37 #define CX_LL_PTR(cur, off) (*(void**)(((char*)(cur))+(off))) |
38 #define ll_prev(node) CX_LL_PTR(node, loc_prev) |
38 #define ll_prev(node) CX_LL_PTR(node, loc_prev) |
39 #define ll_next(node) CX_LL_PTR(node, loc_next) |
39 #define ll_next(node) CX_LL_PTR(node, loc_next) |
40 #define ll_advance(node) CX_LL_PTR(node, loc_advance) |
40 #define ll_advance(node) CX_LL_PTR(node, loc_advance) |
453 *end = *begin; |
453 *end = *begin; |
454 } |
454 } |
455 *begin = prev; |
455 *begin = prev; |
456 } |
456 } |
457 |
457 |
458 /* HIGH LEVEL LINKED LIST IMPLEMENTATION */ |
458 // HIGH LEVEL LINKED LIST IMPLEMENTATION |
459 |
459 |
460 typedef struct cx_linked_list_node cx_linked_list_node; |
460 typedef struct cx_linked_list_node cx_linked_list_node; |
461 struct cx_linked_list_node { |
461 struct cx_linked_list_node { |
462 cx_linked_list_node *prev; |
462 cx_linked_list_node *prev; |
463 cx_linked_list_node *next; |
463 cx_linked_list_node *next; |