diff options
| author | gingerBill <bill@gingerbill.org> | 2021-07-28 00:59:30 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-07-28 00:59:30 +0100 |
| commit | af32aba7fc327cc1c0b37c4919d809adcaab45dc (patch) | |
| tree | 9e03af7905e08fbf1aaa132b8b8e7354c2caebec /src/common.cpp | |
| parent | 541c79c01a6af378aa71f4dbd59fa5c782c24802 (diff) | |
Modify MPMCQueue behaviour to use `i32` over `isize`; Correct cache line padding within MPMCQueue
Diffstat (limited to 'src/common.cpp')
| -rw-r--r-- | src/common.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common.cpp b/src/common.cpp index 8a51bbcb5..fb2b2e0d8 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -763,7 +763,19 @@ isize next_pow2_isize(isize n) { n++; return n; } - +u32 next_pow2_u32(u32 n) { + if (n == 0) { + return 0; + } + n--; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + n++; + return n; +} i32 bit_set_count(u32 x) { |