| Modifier and Type | Field and Description |
|---|---|
| private static final short[] | DIGITS
Each element of the array represents the packaging of two ascii characters based on little endian:
00 -> '0' | ('0' << 8) -> 0x3030
01 -> '0' | ('1' << 8) -> 0x3130
02 -> '0' | ('2' << 8) -> 0x3230
...
|
| private static final JavaLangAccess | |
| private static final Unsafe |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | appendPair(StringBuilder
the buf, int StringBuilder to append to.the v)int value (should be between 0 and 99 inclusive).Appends the two-digit string representation of the |
| public static void | appendQuad(StringBuilder
the buf, int StringBuilder to append to.the v)int value (should be between 0 and 9999 inclusive).Appends the four-digit string representation of the |
| public static int | Returns: index of the most significant digit or minus sign, if presentvalue to convert i, int next index, after the least significant digit index, char[] target buffer, UTF16-coded. buf)This is a variant of |
| public static void | putPair(char[]
byte buffer to copy into buf, int insert point charPos, int to convert v)Insert the 2-chars integer into the buf as 2 decimal digit ASCII chars,
only least significant 16 bits of |
| public static int | Returns: string sizeint value x)Returns the string representation size for a given int value. |
| public static int | Returns: string sizelong value x)Returns the string representation size for a given long value. |
| public static int | Returns: index of the most significant digit or minus sign, if presentvalue to convert i, int next index, after the least significant digit index, byte[] target buffer, Latin1-encoded buf)Places characters representing the integer i into the character array buf. |
| public static int | Returns: index of the most significant digit or minus sign, if presentvalue to convert i, int next index, after the least significant digit index, byte[] target buffer, Latin1-encoded buf)Places characters representing the long i into the character array buf. |
| public static int | Returns: index of the most significant digit or minus sign, if presentvalue to convert i, int next index, after the least significant digit index, byte[] target buffer, UTF16-coded. buf)This is a variant of |
| public static int | Returns: index of the most significant digit or minus sign, if presentvalue to convert i, int next index, after the least significant digit index, byte[] target buffer, UTF16-coded. buf)This is a variant of |
| private static void | |
| private static void | |
| public static void | uncheckedPutPairLatin1(byte[]
byte buffer to copy into buf, int insert point charPos, int to convert v)Insert the 2-bytes integer into the buf as 2 decimal digit ASCII bytes,
only least significant 16 bits of |
| public static void | uncheckedPutPairUTF16(byte[]
byte buffer to copy into buf, int insert point charPos, int to convert v)Insert the 2-chars integer into the buf as 2 decimal digit UTF16 bytes,
only least significant 16 bits of |
| DIGITS | back to summary |
|---|---|
| private static final short[] DIGITS Each element of the array represents the packaging of two ascii characters based on little endian:
00 -> '0' | ('0' << 8) -> 0x3030
01 -> '0' | ('1' << 8) -> 0x3130
02 -> '0' | ('2' << 8) -> 0x3230
...
10 -> '1' | ('0' << 8) -> 0x3031
11 -> '1' | ('1' << 8) -> 0x3131
12 -> '1' | ('2' << 8) -> 0x3231
...
97 -> '9' | ('7' << 8) -> 0x3739
98 -> '9' | ('8' << 8) -> 0x3839
99 -> '9' | ('9' << 8) -> 0x3939
| |
| JLA | back to summary |
|---|---|
| private static final JavaLangAccess JLA | |
| UNSAFE | back to summary |
|---|---|
| private static final Unsafe UNSAFE | |
| DecimalDigits | back to summary |
|---|---|
| private DecimalDigits() Constructor. | |
| appendPair | back to summary |
|---|---|
| public static void appendPair(StringBuilder buf, int v) Appends the two-digit string representation of the
The integer
| |
| appendQuad | back to summary |
|---|---|
| public static void appendQuad(StringBuilder buf, int v) Appends the four-digit string representation of the
The integer
| |
| getChars | back to summary |
|---|---|
| public static int getChars(long i, int index, char[] buf) This is a variant of
| |
| putPair | back to summary |
|---|---|
| public static void putPair(char[] buf, int charPos, int v) Insert the 2-chars integer into the buf as 2 decimal digit ASCII chars,
only least significant 16 bits of
| |
| stringSize | back to summary |
|---|---|
| public static int stringSize(int x) Returns the string representation size for a given int value. Implementation Note There are other ways to compute this: e.g. binary search, but values are biased heavily towards zero, and therefore linear search wins. The iteration results are also routinely inlined in the generated code after loop unrolling.
| |
| stringSize | back to summary |
|---|---|
| public static int stringSize(long x) Returns the string representation size for a given long value. Implementation Note There are other ways to compute this: e.g. binary search, but values are biased heavily towards zero, and therefore linear search wins. The iteration results are also routinely inlined in the generated code after loop unrolling.
| |
| uncheckedGetCharsLatin1 | back to summary |
|---|---|
| public static int uncheckedGetCharsLatin1(int i, int index, byte[] buf) Places characters representing the integer i into the character array buf. The characters are placed into the buffer backwards starting with the least significant digit at the specified index (exclusive), and working backwards from there. Implementation Note This method converts positive inputs into negative values, to cover the Integer.MIN_VALUE case. Converting otherwise (negative to positive) will expose -Integer.MIN_VALUE that overflows integer. WARNING: This method does not perform any bound checks.
| |
| uncheckedGetCharsLatin1 | back to summary |
|---|---|
| public static int uncheckedGetCharsLatin1(long i, int index, byte[] buf) Places characters representing the long i into the character array buf. The characters are placed into the buffer backwards starting with the least significant digit at the specified index (exclusive), and working backwards from there. Implementation Note This method converts positive inputs into negative values, to cover the Long.MIN_VALUE case. Converting otherwise (negative to positive) will expose -Long.MIN_VALUE that overflows long. WARNING: This method does not perform any bound checks.
| |
| uncheckedGetCharsUTF16 | back to summary |
|---|---|
| public static int uncheckedGetCharsUTF16(int i, int index, byte[] buf) This is a variant of Warning This method does not perform any bound checks.
| |
| uncheckedGetCharsUTF16 | back to summary |
|---|---|
| public static int uncheckedGetCharsUTF16(long i, int index, byte[] buf) This is a variant of Warning This method does not perform any bound checks.
| |
| uncheckedPutCharLatin1 | back to summary |
|---|---|
| private static void uncheckedPutCharLatin1(byte[] buf, int charPos, int c) | |
| uncheckedPutCharUTF16 | back to summary |
|---|---|
| private static void uncheckedPutCharUTF16(byte[] buf, int charPos, int c) | |
| uncheckedPutPairLatin1 | back to summary |
|---|---|
| public static void uncheckedPutPairLatin1(byte[] buf, int charPos, int v) Insert the 2-bytes integer into the buf as 2 decimal digit ASCII bytes,
only least significant 16 bits of Warning This method does not perform any bound checks.
| |
| uncheckedPutPairUTF16 | back to summary |
|---|---|
| public static void uncheckedPutPairUTF16(byte[] buf, int charPos, int v) Insert the 2-chars integer into the buf as 2 decimal digit UTF16 bytes,
only least significant 16 bits of Warning This method does not perform any bound checks.
| |