JDK 8 code review request for initial unsigned integer arithmetic library support

Joe Darcy joe.darcy at oracle.com
Sat Jan 14 05:26:25 UTC 2012


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 

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


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.)



More information about the core-libs-dev mailing list