mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
589f256ffa
The MSVC-specific _umul128 code path had incorrect carry propagation when adding three values (rp[i] + lo + carry). The original code: carry = hi + (sum < lo); only detected overflow between sum and lo, missing overflow in the first addition rp[i] + lo. This caused incorrect bigint calculations on VC 64-bit builds. Fixed by splitting three-way addition into two two-way additions with proper overflow detection for each step: temp = rp_val + lo; sum = temp + carry; carry = hi + (temp < rp_val) + (sum < temp); Co-authored-by: Claude <noreply@anthropic.com>