equal
deleted
inserted
replaced
142 return null; |
142 return null; |
143 } |
143 } |
144 |
144 |
145 // compressedCopy char[] -> byte[] |
145 // compressedCopy char[] -> byte[] |
146 @HotSpotIntrinsicCandidate |
146 @HotSpotIntrinsicCandidate |
147 private static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) { |
147 public static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) { |
148 for (int i = 0; i < len; i++) { |
148 for (int i = 0; i < len; i++) { |
149 char c = src[srcOff]; |
149 char c = src[srcOff]; |
150 if (c > 0xFF) { |
150 if (c > 0xFF) { |
151 len = 0; |
151 len = 0; |
152 break; |
152 break; |
160 |
160 |
161 // compressedCopy byte[] -> byte[] |
161 // compressedCopy byte[] -> byte[] |
162 @HotSpotIntrinsicCandidate |
162 @HotSpotIntrinsicCandidate |
163 public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { |
163 public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { |
164 // We need a range check here because 'getChar' has no checks |
164 // We need a range check here because 'getChar' has no checks |
165 checkBoundsOffCount(srcOff, len, src.length); |
165 checkBoundsOffCount(srcOff << 1, len << 1, src.length); |
166 for (int i = 0; i < len; i++) { |
166 for (int i = 0; i < len; i++) { |
167 char c = getChar(src, srcOff); |
167 char c = getChar(src, srcOff); |
168 if (c > 0xFF) { |
168 if (c > 0xFF) { |
169 len = 0; |
169 len = 0; |
170 break; |
170 break; |
209 } |
209 } |
210 |
210 |
211 @HotSpotIntrinsicCandidate |
211 @HotSpotIntrinsicCandidate |
212 public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) { |
212 public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) { |
213 // We need a range check here because 'getChar' has no checks |
213 // We need a range check here because 'getChar' has no checks |
214 checkBoundsOffCount(srcBegin, srcEnd - srcBegin, value.length); |
214 if (srcBegin < srcEnd) { |
|
215 checkBoundsOffCount(srcBegin << 1, (srcEnd - srcBegin) << 1, value.length); |
|
216 } |
215 for (int i = srcBegin; i < srcEnd; i++) { |
217 for (int i = srcBegin; i < srcEnd; i++) { |
216 dst[dstBegin++] = getChar(value, i); |
218 dst[dstBegin++] = getChar(value, i); |
217 } |
219 } |
218 } |
220 } |
219 |
221 |