Misc: fixed strict aliasing violation in ImHashData(). (#9557)

The SSE4.2 path read the input through an `ImU32` pointer but callers
hash floats, pointers and structs. With clang 23 and LTO (such as
`-O2 -msse4.2 -flto -fuse-ld=lld`) the float stores in
`ImFontAtlasBakedGetId()` were optimized away, so every size of a font
got the same `BakedId`.
This commit is contained in:
Stanislaw Halik 2026-09-26 12:34:24 +02:00
parent aa0181478b
commit 3831352fa4

View file

@ -2493,7 +2493,7 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed)
#else
while (data + 4 <= data_end)
{
crc = _mm_crc32_u32(crc, *(ImU32*)data);
ImU32 v; memcpy(&v, data, sizeof(v)); crc = _mm_crc32_u32(crc, v);
data += 4;
}
while (data < data_end)