diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-07-09 00:31:57 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-07-09 00:31:57 +0100 |
| commit | f7a669d342c96451a3e0be84e2e51af8631f90ec (patch) | |
| tree | c0c81ed66c8229c182bac13ef8107ca642debd74 /src/common.cpp | |
| parent | 9ba2a6d02cab3feff9d70f7bb9c2e8eb72bc5533 (diff) | |
Initial release version
* Code cleanup
* Fix some TODOs
* Reduce heap allocation use and replace with arena allocation
Diffstat (limited to 'src/common.cpp')
| -rw-r--r-- | src/common.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common.cpp b/src/common.cpp index 7b8f7cf02..7d7bed316 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -46,6 +46,23 @@ gb_inline u64 hash_pointer(void *ptr) { return p; } + + +// Doubly Linked Lists + +#define DLIST_SET(curr_element, next_element) do { \ + (curr_element)->next = (next_element); \ + (curr_element)->next->prev = (curr_element); \ + (curr_element) = (curr_element)->next; \ +} while (0) + +#define DLIST_APPEND(root_element, curr_element, next_element) do { \ + if ((root_element) == NULL) \ + (root_element) = (curr_element) = (next_element); \ + else \ + DLIST_SET(curr_element, next_element); \ +} while (0) + //////////////////////////////////////////////////////////////// // // Generic Data Structures |