Details

Enhancement

Resolution: Fixed

P4

1.4.0, 1.4.0_02, 1.4.1, 1.4.2

b25

generic, x86, itanium

generic, solaris_8, windows_2000, windows_xp

Verified
Description
Name: jd38982 Date: 02/04/2002
Customer Problem Description:
jdk doesn't support unsigned long value. The "long" data type is a
signed long data type in jdk1.3 or jdk1.4. That means for positive number, it only support up to 63 bits. If a positive number that is bigger than 63
bits, it becomes a negative number. We need jdk to support an unsigned
long value.
###@###.### 20020920
Name: rmT116609 Date: 08/14/2003
A DESCRIPTION OF THE REQUEST :
Java primitive number are byte (8 bits signed), short (16 bits signed), int (32 bits signed) and long (64 bits signed). It may be the time for java to add capability to optimal arithmetic with 128 bits signed integers because 64 bits processors will make 128 bits operation as fast as actual 64 bits. We propose the keyword 'huge' and also the associated class Huge. Moreover algorithm like digest (SHA, MD5) and cryptography need to make operation on block of 128 bits size !
JUSTIFICATION :
It will help making computation on CRC, Error Correcting Code, Digest (MD5) impressively faster than with BigInteger class.
It is a natural evolution like for type long in a 32 bits environnement.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED 
To have more choice for choosing type of integers to make arithmetic with java.
To have a powerful type to make 128 bits computation which will be JVM optimized.
ACTUAL 
To make arithmetic with more than 63 bits unsigned and 64 bits signed you have to use the class BigInteger which is far more slower than using primitive type.
Instead you have to code your own 128 bits computation instrument which cannot be as optimized as a native primitive java type !
CUSTOMER SUBMITTED WORKAROUND :
Using java.math.BigInteger
(Review ID: 199026)
======================================================================
Discussion of API for this RFE:
http://mail.openjdk.java.net/pipermail/corelibsdev/2012January/008926.html
Attachments
Issue Links
 duplicates

JDK4830125 RFE: adding partial support for unsigned primitive integers and huge (128 bits)
 Closed

JDK4879804 unsigned data types in Java
 Closed
 relates to

JDK7132338 Use @code friendly idiom for '\' in javadoc
 Closed

JDK6850613 Add support for saturated casts
 Open

JDK6322074 Converting integers to string as if unsigned
 Closed

JDK4215269 Some Integer.toHexString(int) results cannot be decoded back to an int
 Closed

JDK4850194 (C1) Intrinsics for operations used in crypto
 Closed

JDK6245253 add uint8, uint16, uint32, uint64, sint8, sint16, sint32, sint64
 Closed

JDK7143629 JDK jar/zip code should use unsigned library support
 Closed

JDK7190503 More unsigned library operations
 Closed

JDK8238669 Long.divideUnsigned is extremely slow for certain values (Needs to be Intrinsic)
 Closed