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.
| 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. |
| 1538 | ImGuiID 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. |
no outgoing calls
no test coverage detected