On Mon, 22 Jan 2024 16:15:57 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > What about splitting the result of `divWord()` into its components `q` and > `r` and check that `0 <= r < d` and `n == q * d + r`? Mathematically this > should be sufficient. Perhaps you might need to take care about unsigned vs > signed arithmetic. @rgiulietti In this case, the unsigned arithmetic is not a problem, since `(d & LONG_MASK) > 0` and multiplication and addition semantics is equivalent in signed/unsigned integers. Perhaps, it would be better to call directly `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)` to possibly use directly assembly code, since they are annotated as IntrinsicCandidate. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17291#issuecomment-1904381418