Skip to content

Commit 8fc6ee0

Browse files
committed
simplify code
1 parent 2b50ce9 commit 8fc6ee0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/src/main/java/com/alibaba/fastjson2/JSONReaderASCII.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public final long readFieldNameHashCode() {
171171
offset += 3;
172172
} else if ((c3 = bytes[offset + 3]) == quote
173173
&& c0 != '\\' && c1 != '\\' && c2 != '\\'
174-
&& c0 >= 0 && c1 >= 0 && c2 > 0
174+
&& (c0 | c1) >= 0 && c2 > 0
175175
) {
176176
nameValue
177177
= (c2 << 16)
@@ -182,7 +182,7 @@ public final long readFieldNameHashCode() {
182182
offset += 4;
183183
} else if ((c4 = bytes[offset + 4]) == quote
184184
&& c0 != '\\' && c1 != '\\' && c2 != '\\' && c3 != '\\'
185-
&& c0 >= 0 && c1 >= 0 && c2 >= 0 && c3 > 0
185+
&& (c0 | c1 | c2) >= 0 && c3 > 0
186186
) {
187187
nameValue
188188
= (c3 << 24)
@@ -194,7 +194,7 @@ public final long readFieldNameHashCode() {
194194
offset += 5;
195195
} else if ((c5 = bytes[offset + 5]) == quote
196196
&& c0 != '\\' && c1 != '\\' && c2 != '\\' && c3 != '\\' && c4 != '\\'
197-
&& c0 >= 0 && c1 >= 0 && c2 >= 0 && c3 >= 0 && c4 > 0
197+
&& (c0 | c1 | c2 | c3) >= 0 && c4 > 0
198198
) {
199199
nameValue
200200
= (((long) c4) << 32)
@@ -207,7 +207,7 @@ public final long readFieldNameHashCode() {
207207
offset += 6;
208208
} else if ((c6 = bytes[offset + 6]) == quote
209209
&& c0 != '\\' && c1 != '\\' && c2 != '\\' && c3 != '\\' && c4 != '\\' && c5 != '\\'
210-
&& c0 >= 0 && c1 >= 0 && c2 >= 0 && c3 >= 0 && c4 >= 0 && c5 > 0
210+
&& (c0 | c1 | c2 | c3 | c4) >= 0 && c5 > 0
211211
) {
212212
nameValue
213213
= (((long) c5) << 40)
@@ -221,7 +221,7 @@ public final long readFieldNameHashCode() {
221221
offset += 7;
222222
} else if ((c7 = bytes[offset + 7]) == quote
223223
&& c0 != '\\' && c1 != '\\' && c2 != '\\' && c3 != '\\' && c4 != '\\' && c5 != '\\' && c6 != '\\'
224-
&& c0 >= 0 && c1 >= 0 && c2 >= 0 && c3 >= 0 && c4 >= 0 && c5 >= 0 && c6 > 0
224+
&& (c0 | c1 | c2 | c3 | c4 | c5) >= 0 && c6 > 0
225225
) {
226226
nameValue
227227
= (((long) c6) << 48)
@@ -236,7 +236,7 @@ public final long readFieldNameHashCode() {
236236
offset += 8;
237237
} else if (bytes[offset + 8] == quote
238238
&& c0 != '\\' && c1 != '\\' && c2 != '\\' && c3 != '\\' && c4 != '\\' && c5 != '\\' && c6 != '\\' && c7 != '\\'
239-
&& c0 >= 0 && c1 >= 0 && c2 >= 0 && c3 >= 0 && c4 >= 0 && c5 >= 0 && c6 >= 0 && c7 > 0
239+
&& (c0 | c1 | c2 | c3 | c4 | c5 | c6) >= 0 && c7 > 0
240240
) {
241241
nameValue
242242
= (((long) c7) << 56)

0 commit comments

Comments
 (0)