Skip to content

Commit 3e89dd7

Browse files
committed
Cleanups.
1 parent 53a5a88 commit 3e89dd7

File tree

2 files changed

+2
-47
lines changed

2 files changed

+2
-47
lines changed

java/src/json/ext/StringEncoder.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ boolean searchEscape(EscapeScanner.State state) throws IOException {
224224
}
225225

226226
void encodeBasic(ByteList src) throws IOException {
227-
// EscapeScanner.State state = new EscapeScanner.State();
228-
// state.ptrBytes = src.unsafeBytes();
229-
// state.ptr = src.begin();
230-
// state.len = src.realSize();
231-
// state.beg = 0;
232-
// state.pos = 0;
233-
234227
byte[] hexdig = HEX;
235228
byte[] scratch = aux;
236229

@@ -307,44 +300,6 @@ void encode(ByteList src) throws IOException {
307300
}
308301
}
309302

310-
// while (state.pos < state.len) {
311-
// int ch = Byte.toUnsignedInt(state.ptrBytes[state.ptr + state.pos]);
312-
// int ch_len = escapeTable[ch];
313-
// /* JSON encoding */
314-
315-
// if (ch_len > 0) {
316-
// switch (ch_len) {
317-
// case 9: {
318-
// state.beg = state.pos = flushPos(state.pos, state.beg, state.ptrBytes, state.ptr, 1);
319-
// escapeAscii(ch, scratch, hexdig);
320-
// break;
321-
// }
322-
// case 11: {
323-
// int b2 = Byte.toUnsignedInt(state.ptrBytes[state.ptr + state.pos + 1]);
324-
// if (b2 == 0x80) {
325-
// int b3 = Byte.toUnsignedInt(state.ptrBytes[state.ptr + state.pos + 2]);
326-
// if (b3 == 0xA8) {
327-
// state.beg = state.pos = flushPos(state.pos, state.beg, state.ptrBytes, state.ptr, 3);
328-
// append(BACKSLASH_U2028, 0, 6);
329-
// break;
330-
// } else if (b3 == 0xA9) {
331-
// state.beg = state.pos = flushPos(state.pos, state.beg, state.ptrBytes, state.ptr, 3);
332-
// append(BACKSLASH_U2029, 0, 6);
333-
// break;
334-
// }
335-
// }
336-
// ch_len = 3;
337-
// // fallthrough
338-
// }
339-
// default:
340-
// state.pos += ch_len;
341-
// break;
342-
// }
343-
// } else {
344-
// state.pos++;
345-
// }
346-
// }
347-
348303
if (state.beg < state.len) {
349304
append(state.ptrBytes, state.ptr + state.beg, state.len - state.beg);
350305
}

java/src/json/ext/VectorizedEscapeScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public boolean scan(State _state) throws IOException {
3030

3131
// bytes are unsigned in java, so we need to check for negative values
3232
// to determine if we have a byte that is less than 0 (>= 128).
33-
VectorMask<Byte> negative = ByteVector.zero(species).lt(chunk);
33+
VectorMask<Byte> nonNegative = ByteVector.zero(species).lt(chunk);
3434

3535
VectorMask<Byte> tooLowOrDblQuote = chunk.lanewise(VectorOperators.XOR, ByteVector.broadcast(species, 2))
3636
.lt(ByteVector.broadcast(species, 33));
3737

38-
VectorMask<Byte> needsEscape = chunk.eq(ByteVector.broadcast(species, '\\')).or(tooLowOrDblQuote).and(negative);
38+
VectorMask<Byte> needsEscape = chunk.eq(ByteVector.broadcast(species, '\\')).or(tooLowOrDblQuote).and(nonNegative);
3939
if (needsEscape.anyTrue()) {
4040
state.hasMatches = true;
4141
state.chunkStart = state.ptr + state.pos;

0 commit comments

Comments
 (0)