portable-lib
portable-lib copied to clipboard
Portable C, C++ code for hash tables, bloom filters, string-search, string utilities, hash functions, arc4random
arc4random was modified to prevent rekey be less predictable
Both `__store_ring()` and `__load_ring()` have a same bug. function `__store_ring`: https://github.com/opencoff/portable-lib/blob/10c32868e57c65b314e24834be6c62b1e856e74e/inc/fast/ringbuf.h#L237-L277 - Bug: When `n=1`, function `__store_ring(ring, head, elements, n)` actually writes 4 elements into the ring. - Reason: `loop`...
https://github.com/opencoff/portable-lib/blob/9b479750f6fb4f4265782370e238e4443cf22c93/test/t_ringbuf.c#L188-L199 Maybe simply `asm("nop")` is better: ``` for (i = 0; i < n; ++i) { asm("nop"); rte_pause(); } ```