Bug in Long.parseUnsignedLong
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Dec 19 19:26:49 UTC 2013
Upon inspection only that indeed looks correct.
Thanks …
On Dec 19, 2013, at 10:28 AM, Louis Wasserman wrote:
> Here's one approach that works: there is overflow iff
>
> compareUnsigned(first, divideUnsigned(MAX_UNSIGNED, radix)) > 0 || (first == divideUnsigned(MAX_UNSIGNED, radix) && second > remainderUnsigned(MAX_UNSIGNED, radix));
>
> Since radix <= Character.MAX_RADIX, you can precompute the divides and remainders in a small table.
More information about the core-libs-dev
mailing list