Prime number offset for hash function.
| 24 | namespace bthread { |
| 25 | // Prime number offset for hash function. |
| 26 | inline size_t prime_offset(size_t seed) { |
| 27 | uint32_t offsets[] = { |
| 28 | #include "bthread/offset_inl.list" |
| 29 | }; |
| 30 | return offsets[seed % ARRAY_SIZE(offsets)]; |
| 31 | } |
| 32 | |
| 33 | inline size_t prime_offset() { |
| 34 | return prime_offset(butil::fast_rand()); |
no test coverage detected