MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / ImHashData

Function ImHashData

extern/imgui/imgui.cpp:1902–1910  ·  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

1900// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.
1901// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
1902ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed)
1903{
1904 ImU32 crc = ~seed;
1905 const unsigned char* data = (const unsigned char*)data_p;
1906 const ImU32* crc32_lut = GCrc32LookupTable;
1907 while (data_size-- != 0)
1908 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];
1909 return ~crc;
1910}
1911
1912// Zero-terminated string hash, with support for ### to reset back to seed value
1913// 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