diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:43:25 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:43:25 +0100 |
| commit | 01fe9f2eeab8b54487a4673e74851160adb1718d (patch) | |
| tree | d95bcb5c81a76660c01fa8434bf59613b6ac7586 /src/common.cc | |
| parent | ef816e31ba15bbda487298339c5ca88456c31d33 (diff) | |
working on array implementation
Diffstat (limited to 'src/common.cc')
| -rw-r--r-- | src/common.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common.cc b/src/common.cc index df8b9aa..36ddbeb 100644 --- a/src/common.cc +++ b/src/common.cc @@ -44,8 +44,8 @@ typedef intptr_t isize; #define spanic(msg) panic("%s", msg) #undef assert -#define assert(cond) \ - do { \ +#define assert(cond) \ + do { \ if (unlikely(!(cond))) panic("assertion failed: %s", #cond); \ } while (0) @@ -102,7 +102,7 @@ static inline void link_after(Link* prev, Link* nlink) { nlink->next = next; prev->next = nlink; - if(next == nullptr) return; + if (next == nullptr) return; next->prev = nlink; } @@ -112,11 +112,9 @@ static inline void link_remove(Link* item) { Link* prev = item->prev; Link* next = item->next; - if(prev != nullptr) - prev->next = next; + if (prev != nullptr) prev->next = next; - if(next != nullptr) - next->prev = prev; + if (next != nullptr) next->prev = prev; item->prev = item->next = nullptr; } |
