mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-14 15:00:30 +02:00
The fallback (which RISC-V uses) did its integer arithmetic in plain int, where signed overflow and left shifts of negative values are undefined, and converted out of range floats with a cast, which is undefined too: RISC-V gives INT_MAX for NaN where SSE gives INT_MIN and NEON 0. With GCC on RISC-V that broke GEUVSpanCore in the GEMath unit test. Now the arithmetic wraps through uint32_t, like the SIMD instructions, and an out of range or NaN conversion gives INT_MIN, like SSE. Also skip GERowSum's zero terms before computing their shift, as their exponent can be INT_MIN. Found with -fsanitize=undefined on the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>