@@ -149,7 +149,7 @@ public static int stringSize(long x) {
149
149
* @param buf target buffer, Latin1-encoded
150
150
* @return index of the most significant digit or minus sign, if present
151
151
*/
152
- public static int getCharsLatin1 (int i , int index , byte [] buf ) {
152
+ public static int uncheckedGetCharsLatin1 (int i , int index , byte [] buf ) {
153
153
// Used by trusted callers. Assumes all necessary bounds checks have been done by the caller.
154
154
int q ;
155
155
int charPos = index ;
@@ -163,20 +163,20 @@ public static int getCharsLatin1(int i, int index, byte[] buf) {
163
163
while (i <= -100 ) {
164
164
q = i / 100 ;
165
165
charPos -= 2 ;
166
- putPairLatin1 (buf , charPos , (q * 100 ) - i );
166
+ uncheckedPutPairLatin1 (buf , charPos , (q * 100 ) - i );
167
167
i = q ;
168
168
}
169
169
170
170
// We know there are at most two digits left at this point.
171
171
if (i <= -10 ) {
172
172
charPos -= 2 ;
173
- putPairLatin1 (buf , charPos , -i );
173
+ uncheckedPutPairLatin1 (buf , charPos , -i );
174
174
} else {
175
- putCharLatin1 (buf , --charPos , '0' - i );
175
+ uncheckedPutCharLatin1 (buf , --charPos , '0' - i );
176
176
}
177
177
178
178
if (negative ) {
179
- putCharLatin1 (buf , --charPos , '-' );
179
+ uncheckedPutCharLatin1 (buf , --charPos , '-' );
180
180
}
181
181
return charPos ;
182
182
}
@@ -199,7 +199,7 @@ public static int getCharsLatin1(int i, int index, byte[] buf) {
199
199
* @param buf target buffer, Latin1-encoded
200
200
* @return index of the most significant digit or minus sign, if present
201
201
*/
202
- public static int getCharsLatin1 (long i , int index , byte [] buf ) {
202
+ public static int uncheckedGetCharsLatin1 (long i , int index , byte [] buf ) {
203
203
// Used by trusted callers. Assumes all necessary bounds checks have been done by the caller.
204
204
long q ;
205
205
int charPos = index ;
@@ -213,7 +213,7 @@ public static int getCharsLatin1(long i, int index, byte[] buf) {
213
213
while (i < Integer .MIN_VALUE ) {
214
214
q = i / 100 ;
215
215
charPos -= 2 ;
216
- putPairLatin1 (buf , charPos , (int )((q * 100 ) - i ));
216
+ uncheckedPutPairLatin1 (buf , charPos , (int )((q * 100 ) - i ));
217
217
i = q ;
218
218
}
219
219
@@ -223,35 +223,35 @@ public static int getCharsLatin1(long i, int index, byte[] buf) {
223
223
while (i2 <= -100 ) {
224
224
q2 = i2 / 100 ;
225
225
charPos -= 2 ;
226
- putPairLatin1 (buf , charPos , (q2 * 100 ) - i2 );
226
+ uncheckedPutPairLatin1 (buf , charPos , (q2 * 100 ) - i2 );
227
227
i2 = q2 ;
228
228
}
229
229
230
230
// We know there are at most two digits left at this point.
231
231
if (i2 <= -10 ) {
232
232
charPos -= 2 ;
233
- putPairLatin1 (buf , charPos , -i2 );
233
+ uncheckedPutPairLatin1 (buf , charPos , -i2 );
234
234
} else {
235
- putCharLatin1 (buf , --charPos , '0' - i2 );
235
+ uncheckedPutCharLatin1 (buf , --charPos , '0' - i2 );
236
236
}
237
237
238
238
if (negative ) {
239
- putCharLatin1 (buf , --charPos , '-' );
239
+ uncheckedPutCharLatin1 (buf , --charPos , '-' );
240
240
}
241
241
return charPos ;
242
242
}
243
243
244
244
245
245
/**
246
- * This is a variant of {@link DecimalDigits#getCharsLatin1 (int, int, byte[])}, but for
246
+ * This is a variant of {@link DecimalDigits#uncheckedGetCharsLatin1 (int, int, byte[])}, but for
247
247
* UTF-16 coder.
248
248
*
249
249
* @param i value to convert
250
250
* @param index next index, after the least significant digit
251
251
* @param buf target buffer, UTF16-coded.
252
252
* @return index of the most significant digit or minus sign, if present
253
253
*/
254
- public static int getCharsUTF16 (int i , int index , byte [] buf ) {
254
+ public static int uncheckedGetCharsUTF16 (int i , int index , byte [] buf ) {
255
255
// Used by trusted callers. Assumes all necessary bounds checks have been done by the caller.
256
256
int q ;
257
257
int charPos = index ;
@@ -265,35 +265,35 @@ public static int getCharsUTF16(int i, int index, byte[] buf) {
265
265
while (i <= -100 ) {
266
266
q = i / 100 ;
267
267
charPos -= 2 ;
268
- putPairUTF16 (buf , charPos , (q * 100 ) - i );
268
+ uncheckedPutPairUTF16 (buf , charPos , (q * 100 ) - i );
269
269
i = q ;
270
270
}
271
271
272
272
// We know there are at most two digits left at this point.
273
273
if (i <= -10 ) {
274
274
charPos -= 2 ;
275
- putPairUTF16 (buf , charPos , -i );
275
+ uncheckedPutPairUTF16 (buf , charPos , -i );
276
276
} else {
277
- putCharUTF16 (buf , --charPos , '0' - i );
277
+ uncheckedPutCharUTF16 (buf , --charPos , '0' - i );
278
278
}
279
279
280
280
if (negative ) {
281
- putCharUTF16 (buf , --charPos , '-' );
281
+ uncheckedPutCharUTF16 (buf , --charPos , '-' );
282
282
}
283
283
return charPos ;
284
284
}
285
285
286
286
287
287
/**
288
- * This is a variant of {@link DecimalDigits#getCharsLatin1 (long, int, byte[])}, but for
288
+ * This is a variant of {@link DecimalDigits#uncheckedGetCharsLatin1 (long, int, byte[])}, but for
289
289
* UTF-16 coder.
290
290
*
291
291
* @param i value to convert
292
292
* @param index next index, after the least significant digit
293
293
* @param buf target buffer, UTF16-coded.
294
294
* @return index of the most significant digit or minus sign, if present
295
295
*/
296
- public static int getCharsUTF16 (long i , int index , byte [] buf ) {
296
+ public static int uncheckedGetCharsUTF16 (long i , int index , byte [] buf ) {
297
297
// Used by trusted callers. Assumes all necessary bounds checks have been done by the caller.
298
298
long q ;
299
299
int charPos = index ;
@@ -307,7 +307,7 @@ public static int getCharsUTF16(long i, int index, byte[] buf) {
307
307
while (i < Integer .MIN_VALUE ) {
308
308
q = i / 100 ;
309
309
charPos -= 2 ;
310
- putPairUTF16 (buf , charPos , (int )((q * 100 ) - i ));
310
+ uncheckedPutPairUTF16 (buf , charPos , (int )((q * 100 ) - i ));
311
311
i = q ;
312
312
}
313
313
@@ -317,26 +317,26 @@ public static int getCharsUTF16(long i, int index, byte[] buf) {
317
317
while (i2 <= -100 ) {
318
318
q2 = i2 / 100 ;
319
319
charPos -= 2 ;
320
- putPairUTF16 (buf , charPos , (q2 * 100 ) - i2 );
320
+ uncheckedPutPairUTF16 (buf , charPos , (q2 * 100 ) - i2 );
321
321
i2 = q2 ;
322
322
}
323
323
324
324
// We know there are at most two digits left at this point.
325
325
if (i2 <= -10 ) {
326
326
charPos -= 2 ;
327
- putPairUTF16 (buf , charPos , -i2 );
327
+ uncheckedPutPairUTF16 (buf , charPos , -i2 );
328
328
} else {
329
- putCharUTF16 (buf , --charPos , '0' - i2 );
329
+ uncheckedPutCharUTF16 (buf , --charPos , '0' - i2 );
330
330
}
331
331
332
332
if (negative ) {
333
- putCharUTF16 (buf , --charPos , '-' );
333
+ uncheckedPutCharUTF16 (buf , --charPos , '-' );
334
334
}
335
335
return charPos ;
336
336
}
337
337
338
338
/**
339
- * This is a variant of {@link DecimalDigits#getCharsUTF16 (long, int, byte[])}, but for
339
+ * This is a variant of {@link DecimalDigits#uncheckedGetCharsUTF16 (long, int, byte[])}, but for
340
340
* UTF-16 coder.
341
341
*
342
342
* @param i value to convert
@@ -406,10 +406,10 @@ public static void putPair(char[] buf, int charPos, int v) {
406
406
* @param charPos insert point
407
407
* @param v to convert
408
408
*/
409
- public static void putPairLatin1 (byte [] buf , int charPos , int v ) {
409
+ public static void uncheckedPutPairLatin1 (byte [] buf , int charPos , int v ) {
410
410
int packed = DIGITS [v & 0x7f ];
411
- putCharLatin1 (buf , charPos , packed & 0xFF );
412
- putCharLatin1 (buf , charPos + 1 , packed >> 8 );
411
+ uncheckedPutCharLatin1 (buf , charPos , packed & 0xFF );
412
+ uncheckedPutCharLatin1 (buf , charPos + 1 , packed >> 8 );
413
413
}
414
414
415
415
/**
@@ -419,17 +419,17 @@ public static void putPairLatin1(byte[] buf, int charPos, int v) {
419
419
* @param charPos insert point
420
420
* @param v to convert
421
421
*/
422
- public static void putPairUTF16 (byte [] buf , int charPos , int v ) {
422
+ public static void uncheckedPutPairUTF16 (byte [] buf , int charPos , int v ) {
423
423
int packed = DIGITS [v & 0x7f ];
424
- putCharUTF16 (buf , charPos , packed & 0xFF );
425
- putCharUTF16 (buf , charPos + 1 , packed >> 8 );
424
+ uncheckedPutCharUTF16 (buf , charPos , packed & 0xFF );
425
+ uncheckedPutCharUTF16 (buf , charPos + 1 , packed >> 8 );
426
426
}
427
427
428
- private static void putCharLatin1 (byte [] buf , int charPos , int c ) {
428
+ private static void uncheckedPutCharLatin1 (byte [] buf , int charPos , int c ) {
429
429
UNSAFE .putByte (buf , ARRAY_BYTE_BASE_OFFSET + charPos , (byte ) c );
430
430
}
431
431
432
- private static void putCharUTF16 (byte [] buf , int charPos , int c ) {
432
+ private static void uncheckedPutCharUTF16 (byte [] buf , int charPos , int c ) {
433
433
UNSAFE .putCharUnaligned (buf , ARRAY_BYTE_BASE_OFFSET + ((long ) charPos << 1 ), (char ) c );
434
434
}
435
435
}
0 commit comments