MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ImHashData

Function ImHashData

plugins/Cardinal/src/DearImGui/imgui.cpp:1538–1546  ·  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

1536// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.
1537// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
1538ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed)
1539{
1540 ImU32 crc = ~seed;
1541 const unsigned char* data = (const unsigned char*)data_p;
1542 const ImU32* crc32_lut = GCrc32LookupTable;
1543 while (data_size-- != 0)
1544 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];
1545 return ~crc;
1546}
1547
1548// Zero-terminated string hash, with support for ### to reset back to seed value
1549// We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.

Callers 6

GetIDMethod · 0.85
GetIDNoKeepAliveMethod · 0.85
GetIDFromRectangleMethod · 0.85
ImHashFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected