MCPcopy Create free account
hub / github.com/ShenCiao/CialloResearch / ImHashData

Function ImHashData

imgui/imgui.cpp:1906–1914  ·  view source on GitHub ↗

Known size hash It is ok to call ImHashData on a string with known length but the ### operator won't be supported. FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.

Source from the content-addressed store, hash-verified

1904// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.
1905// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
1906ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed)
1907{
1908 ImU32 crc = ~seed;
1909 const unsigned char* data = (const unsigned char*)data_p;
1910 const ImU32* crc32_lut = GCrc32LookupTable;
1911 while (data_size-- != 0)
1912 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];
1913 return ~crc;
1914}
1915
1916// Zero-terminated string hash, with support for ### to reset back to seed value
1917// We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.

Callers 4

GetIDMethod · 0.85
GetIDFromRectangleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected