A little different approach...
I worry about the wording of e.g. toUnsignedInt(x).
At first look, it claims to return an unsigned integer, which fairly doesn't
exist in Java for now.
1. Better: unsignedIntValueOf(x)
2. We could have a naming problem if unsigned integers were introduced in any future for Java. Then
e.g. toUnsignedInt(x) could have a very different meaning.
Instead e.g.
int Byte.unsignedIntValueOf(byte x) aka int Byte.toUnsignedInt(byte x)
I would vote for
int Integer.unsignedValueOf(byte x)
At least, we only need:
short Short.unsignedValueOf(byte x)
int Integer.unsignedValueOf(short x)
long Long.unsignedValueOf(int x)
BigInteger BigInteger.unsignedValueOf(long x)
-Ulf
Am 14.01.2012 06:26, schrieb Joe Darcy:
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/