On Fri, Jan 10, 2025 at 8:48 PM Charles Oliver Nutter <head...@headius.com>
wrote:

> This pasted weirdly... but it doesn't matter because there's an additional
> flaw: it will reject *all* negative results because the high 64 bits will
> be non-zero.
>

This version passes all my tests:

if ((high == 0 && low >= 0) // result is within [0, MAX]
        || (high == -1 && low < 0)) { // result is within [MIN, 0)
    return low;
}

Reply via email to