mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +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
@@ -18727,8 +18727,8 @@ const char* wuffs_json__error__internal_error_inconsistent_i_o =
|
|||||||
|
|
||||||
// ---------------- Private Consts
|
// ---------------- Private Consts
|
||||||
|
|
||||||
static const uint8_t //
|
static const uint8_t //
|
||||||
wuffs_json__backslashes[256] //
|
wuffs_json__lut_backslashes[256] //
|
||||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, 0, 0,
|
||||||
@@ -18746,8 +18746,8 @@ static const uint8_t //
|
|||||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t //
|
static const uint8_t //
|
||||||
wuffs_json__classes[256] //
|
wuffs_json__lut_classes[256] //
|
||||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 15, 15, 15, 15,
|
15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 15, 15, 15, 15,
|
||||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 1, 15,
|
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 1, 15,
|
||||||
@@ -18766,8 +18766,8 @@ static const uint8_t //
|
|||||||
15, 15, 15, 15,
|
15, 15, 15, 15,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t //
|
static const uint8_t //
|
||||||
wuffs_json__hexadecimal_digits[256] //
|
wuffs_json__lut_hexadecimal_digits[256] //
|
||||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
@@ -18981,7 +18981,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
goto label__outer__continue;
|
goto label__outer__continue;
|
||||||
}
|
}
|
||||||
v_c = wuffs_base__load_u8be(iop_a_src);
|
v_c = wuffs_base__load_u8be(iop_a_src);
|
||||||
v_class = wuffs_json__classes[v_c];
|
v_class = wuffs_json__lut_classes[v_c];
|
||||||
if (v_class != 0) {
|
if (v_class != 0) {
|
||||||
goto label__ws__break;
|
goto label__ws__break;
|
||||||
}
|
}
|
||||||
@@ -19121,7 +19121,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
}
|
}
|
||||||
v_backslash =
|
v_backslash =
|
||||||
((uint8_t)((wuffs_base__load_u16le(iop_a_src) >> 8)));
|
((uint8_t)((wuffs_base__load_u16le(iop_a_src) >> 8)));
|
||||||
v_c = wuffs_json__backslashes[v_backslash];
|
v_c = wuffs_json__lut_backslashes[v_backslash];
|
||||||
if (v_c > 0) {
|
if (v_c > 0) {
|
||||||
(iop_a_src += 2, wuffs_base__make_empty_struct());
|
(iop_a_src += 2, wuffs_base__make_empty_struct());
|
||||||
*iop_a_dst++ = wuffs_base__make_token(
|
*iop_a_dst++ = wuffs_base__make_token(
|
||||||
@@ -19146,20 +19146,20 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
(((uint64_t)(wuffs_base__load_u48le(iop_a_src))) >> 16);
|
(((uint64_t)(wuffs_base__load_u48le(iop_a_src))) >> 16);
|
||||||
v_uni4_value = 0;
|
v_uni4_value = 0;
|
||||||
v_uni4_ok = 128;
|
v_uni4_ok = 128;
|
||||||
v_c = wuffs_json__hexadecimal_digits[(255 &
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
(v_uni4_string >> 0))];
|
255 & (v_uni4_string >> 0))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 12);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 12);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(255 &
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
(v_uni4_string >> 8))];
|
255 & (v_uni4_string >> 8))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 8);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 8);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(255 &
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
(v_uni4_string >> 16))];
|
255 & (v_uni4_string >> 16))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 4);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 4);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(255 &
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
(v_uni4_string >> 24))];
|
255 & (v_uni4_string >> 24))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 0);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 0);
|
||||||
if (v_uni4_ok == 0) {
|
if (v_uni4_ok == 0) {
|
||||||
@@ -19198,19 +19198,19 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
v_uni4_value = 0;
|
v_uni4_value = 0;
|
||||||
v_uni4_ok = 128;
|
v_uni4_ok = 128;
|
||||||
v_uni4_string >>= 16;
|
v_uni4_string >>= 16;
|
||||||
v_c = wuffs_json__hexadecimal_digits[(
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
255 & (v_uni4_string >> 0))];
|
255 & (v_uni4_string >> 0))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 12);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 12);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
255 & (v_uni4_string >> 8))];
|
255 & (v_uni4_string >> 8))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 8);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 8);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
255 & (v_uni4_string >> 16))];
|
255 & (v_uni4_string >> 16))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 4);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 4);
|
||||||
v_c = wuffs_json__hexadecimal_digits[(
|
v_c = wuffs_json__lut_hexadecimal_digits[(
|
||||||
255 & (v_uni4_string >> 24))];
|
255 & (v_uni4_string >> 24))];
|
||||||
v_uni4_ok &= v_c;
|
v_uni4_ok &= v_c;
|
||||||
v_uni4_value |= (((uint32_t)((v_c & 15))) << 0);
|
v_uni4_value |= (((uint32_t)((v_c & 15))) << 0);
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ pub status "#unsupported recursion depth"
|
|||||||
|
|
||||||
pri status "#internal error: inconsistent I/O"
|
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
|
// 0 1 2 3 4 5 6 7
|
||||||
// 8 9 A B C D E F
|
// 8 9 A B C D E F
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
|
||||||
@@ -100,7 +102,7 @@ pri const backslashes array[256] base.u8 = [
|
|||||||
// and objects.
|
// and objects.
|
||||||
//
|
//
|
||||||
// "String value" includes "this" and "th\u0061t".
|
// "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
|
// 0 1 2 3 4 5 6 7
|
||||||
// 8 9 A B C D E F
|
// 8 9 A B C D E F
|
||||||
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x00 ..= 0x07.
|
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
|
// 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
|
// 0 1 2 3 4 5 6 7
|
||||||
// 8 9 A B C D E F
|
// 8 9 A B C D E F
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
|
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()
|
c = args.src.peek_u8()
|
||||||
class = classes[c]
|
class = lut_classes[c]
|
||||||
if class <> 0x00 { // 0x00 is CLASS_WHITESPACE.
|
if class <> 0x00 { // 0x00 is CLASS_WHITESPACE.
|
||||||
break.ws
|
break.ws
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
|||||||
continue.string_loop
|
continue.string_loop
|
||||||
}
|
}
|
||||||
backslash = (args.src.peek_u16le() >> 8) as base.u8
|
backslash = (args.src.peek_u16le() >> 8) as base.u8
|
||||||
c = backslashes[backslash]
|
c = lut_backslashes[backslash]
|
||||||
if c > 0 {
|
if c > 0 {
|
||||||
args.src.skip32_fast!(actual: 2, worst_case: 2)
|
args.src.skip32_fast!(actual: 2, worst_case: 2)
|
||||||
args.dst.write_fast_token!(
|
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_value = 0
|
||||||
uni4_ok = 0x80
|
uni4_ok = 0x80
|
||||||
|
|
||||||
c = hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||||
uni4_ok &= c
|
uni4_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 12
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 8
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 4
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 0
|
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_ok = 0x80
|
||||||
uni4_string >>= 16
|
uni4_string >>= 16
|
||||||
|
|
||||||
c = hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)]
|
||||||
uni4_ok &= c
|
uni4_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 12
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 8
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 4
|
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_ok &= c
|
||||||
uni4_value |= ((c & 0x0F) as base.u32) << 0
|
uni4_value |= ((c & 0x0F) as base.u32) << 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user