MCPcopy Create free account
hub / github.com/antirez/ds4 / dist_token_hash_update

Function dist_token_hash_update

ds4_distributed.c:1495–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1493#define DS4_DIST_TOKEN_HASH_PRIME 1099511628211ull
1494
1495static uint64_t dist_token_hash_update(uint64_t h, int token) {
1496 uint32_t t = (uint32_t)token;
1497 for (int i = 0; i < 4; i++) {
1498 h ^= (uint64_t)((t >> (i * 8)) & 0xffu);
1499 h *= DS4_DIST_TOKEN_HASH_PRIME;
1500 }
1501 return h;
1502}
1503
1504static uint64_t dist_token_hash_update_span(uint64_t h, const int *tokens, uint32_t n_tokens) {
1505 for (uint32_t i = 0; i < n_tokens; i++) h = dist_token_hash_update(h, tokens[i]);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected