MCPcopy Create free account
hub / github.com/apache/brpc / prime_offset

Function prime_offset

src/bthread/prime_offset.h:26–31  ·  view source on GitHub ↗

Prime number offset for hash function.

Source from the content-addressed store, hash-verified

24namespace bthread {
25// Prime number offset for hash function.
26inline 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
33inline size_t prime_offset() {
34 return prime_offset(butil::fast_rand());

Callers 4

SelectServerMethod · 0.85
SelectServerMethod · 0.85
SelectServerMethod · 0.85
TaskGroupClass · 0.85

Calls 1

fast_randFunction · 0.85

Tested by

no test coverage detected