Really cool stuff Joe. 

One initial note:

parseUnsigned*() returns a signed value that may not be able to hold the entire 
result. I would rather see a larger size be returned to be sure that subsequent 
operations don't have to be special cased for > MAX_VALUE. At minimum some 
documentation describing the interpretation of negative return values is needed.

Mike

On Jan 13 2012, at 21:26 , Joe Darcy wrote:

> 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