mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
14a5cfb87f
replace lossy 2-bit truncation with rotation-based encoding for 32-bit + MRB_USE_FLOAT32, matching the technique used for 64-bit float64. rotl32(bits - ADDEND, 3) maps biased exponents [95, 158] (actual [-32, +31]) to properly tagged inline values with zero precision loss. special values (0, Inf, NaN) use sentinel constants; out-of-range floats fall back to heap-allocated RFloat. also fix a pre-existing alignment issue: RVALUE was 20 bytes on 32-bit, causing 4-byte-aligned objects to be misidentified as immediates by word boxing (WORDBOX_IMMEDIATE_MASK=0x07 requires 8-byte alignment). pad RVALUE to 24 bytes on 32-bit + float32. Co-authored-by: Claude <noreply@anthropic.com>