MCPcopy Create free account
hub / github.com/aboSamoor/pycld2 / OctaHash40

Function OctaHash40

cld2/internal/cldutil_shared.cc:348–354  ·  view source on GitHub ↗

OCTAGRAM wrapper with surrounding spaces Pick up 1..24 bytes plus pre/post space and hash them via mask/shift/add UNDERSHOOTS 1 byte, OVERSHOOTS up to 3 bytes The low 32 bits follow the pattern from above, tuned to different scripts The high 8 bits are a simple sum of all bytes, shifted by 0/1/2/3 bits each For runtime use of tables V3

Source from the content-addressed store, hash-verified

346// The high 8 bits are a simple sum of all bytes, shifted by 0/1/2/3 bits each
347// For runtime use of tables V3
348uint64 OctaHash40(const char* word_ptr, int bytecount) {
349 if (bytecount == 0) {return 0;}
350 uint64 prepost = 0;
351 if (word_ptr[-1] == ' ') {prepost |= kPreSpaceIndicator;}
352 if (word_ptr[bytecount] == ' ') {prepost |= kPostSpaceIndicator;}
353 return OctaHash40Mix(word_ptr, bytecount, prepost);
354}
355
356
357// OCTAGRAM wrapper with surrounding underscores (offline use)

Callers 1

GetOctaHitsFunction · 0.85

Calls 1

OctaHash40MixFunction · 0.85

Tested by

no test coverage detected