mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
Rename std/json Look-Up Table consts
This commit is contained in:
1 parent
9d4eeb7b54
commit
9f0eb266e8
3 files changed
+35
-33
No files matched your search
@@ -18,7 +18,9 @@ pub status "#unsupported recursion depth"
|
||||
|
||||
pri status "#internal error: inconsistent I/O"
|
||||
|
||||
pri const backslashes array[256] base.u8 = [
|
||||
// Look-Up Tables (LUTs).
|
||||
|
||||
pri const lut_backslashes array[256] base.u8 = [
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// 8 9 A B C D E F
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
|
||||
@@ -100,7 +102,7 @@ pri const backslashes array[256] base.u8 = [
|
||||
// and objects.
|
||||
//
|
||||
// "String value" includes "this" and "th\u0061t".
|
||||
pri const classes array[256] base.u8[..= 0x0F] = [
|
||||
pri const lut_classes array[256] base.u8[..= 0x0F] = [
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// 8 9 A B C D E F
|
||||
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x00 ..= 0x07.
|
||||
@@ -142,7 +144,7 @@ pri const classes array[256] base.u8[..= 0x0F] = [
|
||||
// 8 9 A B C D E F
|
||||
]
|
||||
|
||||
pri const hexadecimal_digits array[256] base.u8 = [
|
||||
pri const lut_hexadecimal_digits array[256] base.u8 = [
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// 8 9 A B C D E F
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
|
||||
|
||||
+10
-10
@@ -106,7 +106,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
||||
}
|
||||
|
||||
c = args.src.peek_u8()
|
||||
class = classes[c]
|
||||
class = lut_classes[c]
|
||||
if class <> 0x00 { // 0x00 is CLASS_WHITESPACE.
|
||||
break.ws
|
||||
}
|
||||
@@ -243,7 +243,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
||||
continue.string_loop
|
||||
}
|
||||
backslash = (args.src.peek_u16le() >> 8) as base.u8
|
||||
c = backslashes[backslash]
|
||||
c = lut_backslashes[backslash]
|
||||
if c > 0 {
|
||||
args.src.skip32_fast!(actual: 2, worst_case: 2)
|
||||
args.dst.write_fast_token!(
|
||||
@@ -266,16 +266,16 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
||||
uni4_value = 0
|
||||
uni4_ok = 0x80
|
||||
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 12
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 8)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 8)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 8
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 16)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 16)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 4
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 24)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 24)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 0
|
||||
|
||||
@@ -329,16 +329,16 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
||||
uni4_ok = 0x80
|
||||
uni4_string >>= 16
|
||||
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 12
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 8)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 8)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 8
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 16)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 16)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 4
|
||||
c = hexadecimal_digits[0xFF & (uni4_string >> 24)]
|
||||
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 24)]
|
||||
uni4_ok &= c
|
||||
uni4_value |= ((c & 0x0F) as base.u32) << 0
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user