Open
Description
As @bill-myers originally pointed out here INT_MIN % -1
is mathematically well-defined to be 0
, but Rust currently unconditionally panics instead, as like INT_MIN / -1
it is technically an overflow according to the two's complement representation. If we're incurring a branch to test for this case anyways, then we might as well return the correct result.
("Forked" from #1237.)