MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / ImHashData

Function ImHashData

ImGUI GLFW Tutorial/imgui/imgui.cpp:1492–1500  ·  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

1490// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.
1491// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
1492ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed)
1493{
1494 ImU32 crc = ~seed;
1495 const unsigned char* data = (const unsigned char*)data_p;
1496 const ImU32* crc32_lut = GCrc32LookupTable;
1497 while (data_size-- != 0)
1498 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];
1499 return ~crc;
1500}
1501
1502// Zero-terminated string hash, with support for ### to reset back to seed value
1503// We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.

Callers 6

GetIDMethod · 0.70
GetIDNoKeepAliveMethod · 0.70
GetIDFromRectangleMethod · 0.70
ImHashFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected