mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
946e8c2464
The pack_float, pack_double, unpack_float, and unpack_double functions accessed float/double bytes via a union with uint8_t array, assuming bytes[0] is always the LSB. This is only true on little-endian hosts. Fix by using the same bit-shift approach as the integer pack functions (pack_quad, unpack_quad, etc). Reinterpret float/double as uint32/uint64 and use shifts to extract/assemble bytes in an endian-independent way. Fixes: #6698 (s390x test failures)