MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / ImHashData

Function ImHashData

TheForceEngine/TFE_Ui/imGUI/imgui.cpp:2121–2129  ·  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

2119// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.
2120// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
2121ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed)
2122{
2123 ImU32 crc = ~seed;
2124 const unsigned char* data = (const unsigned char*)data_p;
2125 const ImU32* crc32_lut = GCrc32LookupTable;
2126 while (data_size-- != 0)
2127 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];
2128 return ~crc;
2129}
2130
2131// Zero-terminated string hash, with support for ### to reset back to seed value
2132// We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.

Callers 5

GetIDMethod · 0.85
GetIDFromRectangleMethod · 0.85
GetIDWithSeedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected