Hello,

Polishing up some work I've had *almost* done for a long time, please review an initial take on providing library support for unsigned integer arithmetic:

4504839 Java libraries should provide support for unsigned integer arithmetic 4215269 Some Integer.toHexString(int) results cannot be decoded back to an int
    6322074 Converting integers to string as if unsigned

    http://cr.openjdk.java.net/~darcy/4504839.1/

For the first cut, I've favored keeping the code straightforward over trickier but potentially faster algorithms. Tests need to be written for the unsigned divide and remainder methods, but otherwise the regression tests are fairly extensive.

To avoid the overhead of having to deal with boxed objects, the unsigned functionality is implemented as static methods on Integer and Long, etc. as opposed to introducing new types like UnsignedInteger and UnsignedLong.

(This work is not meant to preclude other integer arithmetic enhancements from going into JDK 8, such as add/subtract/multiply/divide methods that throw exceptions on overflow.)

Thanks,

-Joe


Reply via email to