Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Huffman decoding and encoding for HPACK (RFC7541) |
| 3 | * |
| 4 | * Copyright (C) 2014-2017 Willy Tarreau <willy@haproxy.org> |
| 5 | * Copyright (C) 2017 HAProxy Technologies |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining |
| 8 | * a copy of this software and associated documentation files (the |
| 9 | * "Software"), to deal in the Software without restriction, including |
| 10 | * without limitation the rights to use, copy, modify, merge, publish, |
| 11 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 12 | * permit persons to whom the Software is furnished to do so, subject to |
| 13 | * the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be |
| 16 | * included in all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 25 | * OTHER DEALINGS IN THE SOFTWARE. |
| 26 | */ |
| 27 | |
| 28 | #include <stdio.h> |
Willy Tarreau | a1bd1fa | 2019-03-29 17:26:33 +0100 | [diff] [blame] | 29 | #include <inttypes.h> |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 30 | #include <string.h> |
| 31 | |
Willy Tarreau | 4c7e4b7 | 2020-05-27 12:58:42 +0200 | [diff] [blame] | 32 | #include <haproxy/api.h> |
Willy Tarreau | be327fa | 2020-06-03 09:09:57 +0200 | [diff] [blame] | 33 | #include <haproxy/hpack-huff.h> |
Willy Tarreau | fcce0e1 | 2022-04-01 17:16:44 +0200 | [diff] [blame] | 34 | #include <haproxy/net_helper.h> |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 35 | |
| 36 | struct huff { |
| 37 | uint32_t c; /* code point */ |
| 38 | int b; /* bits */ |
| 39 | }; |
| 40 | |
| 41 | struct rht { |
| 42 | uint8_t c; // code or 0 if length > 8 + position*8 |
| 43 | uint8_t l; // length in bits |
| 44 | }; |
| 45 | |
| 46 | /* huffman table as per RFC7541 appendix B */ |
| 47 | static const struct huff ht[257] = { |
| 48 | [ 0] = { .c = 0x00001ff8, .b = 13 }, |
| 49 | [ 1] = { .c = 0x007fffd8, .b = 23 }, |
| 50 | [ 2] = { .c = 0x0fffffe2, .b = 28 }, |
| 51 | [ 3] = { .c = 0x0fffffe3, .b = 28 }, |
| 52 | [ 4] = { .c = 0x0fffffe4, .b = 28 }, |
| 53 | [ 5] = { .c = 0x0fffffe5, .b = 28 }, |
| 54 | [ 6] = { .c = 0x0fffffe6, .b = 28 }, |
| 55 | [ 7] = { .c = 0x0fffffe7, .b = 28 }, |
| 56 | [ 8] = { .c = 0x0fffffe8, .b = 28 }, |
| 57 | [ 9] = { .c = 0x00ffffea, .b = 24 }, |
| 58 | [ 10] = { .c = 0x3ffffffc, .b = 30 }, |
| 59 | [ 11] = { .c = 0x0fffffe9, .b = 28 }, |
| 60 | [ 12] = { .c = 0x0fffffea, .b = 28 }, |
| 61 | [ 13] = { .c = 0x3ffffffd, .b = 30 }, |
| 62 | [ 14] = { .c = 0x0fffffeb, .b = 28 }, |
| 63 | [ 15] = { .c = 0x0fffffec, .b = 28 }, |
| 64 | [ 16] = { .c = 0x0fffffed, .b = 28 }, |
| 65 | [ 17] = { .c = 0x0fffffee, .b = 28 }, |
| 66 | [ 18] = { .c = 0x0fffffef, .b = 28 }, |
| 67 | [ 19] = { .c = 0x0ffffff0, .b = 28 }, |
| 68 | [ 20] = { .c = 0x0ffffff1, .b = 28 }, |
| 69 | [ 21] = { .c = 0x0ffffff2, .b = 28 }, |
| 70 | [ 22] = { .c = 0x3ffffffe, .b = 30 }, |
| 71 | [ 23] = { .c = 0x0ffffff3, .b = 28 }, |
| 72 | [ 24] = { .c = 0x0ffffff4, .b = 28 }, |
| 73 | [ 25] = { .c = 0x0ffffff5, .b = 28 }, |
| 74 | [ 26] = { .c = 0x0ffffff6, .b = 28 }, |
| 75 | [ 27] = { .c = 0x0ffffff7, .b = 28 }, |
| 76 | [ 28] = { .c = 0x0ffffff8, .b = 28 }, |
| 77 | [ 29] = { .c = 0x0ffffff9, .b = 28 }, |
| 78 | [ 30] = { .c = 0x0ffffffa, .b = 28 }, |
| 79 | [ 31] = { .c = 0x0ffffffb, .b = 28 }, |
| 80 | [ 32] = { .c = 0x00000014, .b = 6 }, |
| 81 | [ 33] = { .c = 0x000003f8, .b = 10 }, |
| 82 | [ 34] = { .c = 0x000003f9, .b = 10 }, |
| 83 | [ 35] = { .c = 0x00000ffa, .b = 12 }, |
| 84 | [ 36] = { .c = 0x00001ff9, .b = 13 }, |
| 85 | [ 37] = { .c = 0x00000015, .b = 6 }, |
| 86 | [ 38] = { .c = 0x000000f8, .b = 8 }, |
| 87 | [ 39] = { .c = 0x000007fa, .b = 11 }, |
| 88 | [ 40] = { .c = 0x000003fa, .b = 10 }, |
| 89 | [ 41] = { .c = 0x000003fb, .b = 10 }, |
| 90 | [ 42] = { .c = 0x000000f9, .b = 8 }, |
| 91 | [ 43] = { .c = 0x000007fb, .b = 11 }, |
| 92 | [ 44] = { .c = 0x000000fa, .b = 8 }, |
| 93 | [ 45] = { .c = 0x00000016, .b = 6 }, |
| 94 | [ 46] = { .c = 0x00000017, .b = 6 }, |
| 95 | [ 47] = { .c = 0x00000018, .b = 6 }, |
| 96 | [ 48] = { .c = 0x00000000, .b = 5 }, |
| 97 | [ 49] = { .c = 0x00000001, .b = 5 }, |
| 98 | [ 50] = { .c = 0x00000002, .b = 5 }, |
| 99 | [ 51] = { .c = 0x00000019, .b = 6 }, |
| 100 | [ 52] = { .c = 0x0000001a, .b = 6 }, |
| 101 | [ 53] = { .c = 0x0000001b, .b = 6 }, |
| 102 | [ 54] = { .c = 0x0000001c, .b = 6 }, |
| 103 | [ 55] = { .c = 0x0000001d, .b = 6 }, |
| 104 | [ 56] = { .c = 0x0000001e, .b = 6 }, |
| 105 | [ 57] = { .c = 0x0000001f, .b = 6 }, |
| 106 | [ 58] = { .c = 0x0000005c, .b = 7 }, |
| 107 | [ 59] = { .c = 0x000000fb, .b = 8 }, |
| 108 | [ 60] = { .c = 0x00007ffc, .b = 15 }, |
| 109 | [ 61] = { .c = 0x00000020, .b = 6 }, |
| 110 | [ 62] = { .c = 0x00000ffb, .b = 12 }, |
| 111 | [ 63] = { .c = 0x000003fc, .b = 10 }, |
| 112 | [ 64] = { .c = 0x00001ffa, .b = 13 }, |
| 113 | [ 65] = { .c = 0x00000021, .b = 6 }, |
| 114 | [ 66] = { .c = 0x0000005d, .b = 7 }, |
| 115 | [ 67] = { .c = 0x0000005e, .b = 7 }, |
| 116 | [ 68] = { .c = 0x0000005f, .b = 7 }, |
| 117 | [ 69] = { .c = 0x00000060, .b = 7 }, |
| 118 | [ 70] = { .c = 0x00000061, .b = 7 }, |
| 119 | [ 71] = { .c = 0x00000062, .b = 7 }, |
| 120 | [ 72] = { .c = 0x00000063, .b = 7 }, |
| 121 | [ 73] = { .c = 0x00000064, .b = 7 }, |
| 122 | [ 74] = { .c = 0x00000065, .b = 7 }, |
| 123 | [ 75] = { .c = 0x00000066, .b = 7 }, |
| 124 | [ 76] = { .c = 0x00000067, .b = 7 }, |
| 125 | [ 77] = { .c = 0x00000068, .b = 7 }, |
| 126 | [ 78] = { .c = 0x00000069, .b = 7 }, |
| 127 | [ 79] = { .c = 0x0000006a, .b = 7 }, |
| 128 | [ 80] = { .c = 0x0000006b, .b = 7 }, |
| 129 | [ 81] = { .c = 0x0000006c, .b = 7 }, |
| 130 | [ 82] = { .c = 0x0000006d, .b = 7 }, |
| 131 | [ 83] = { .c = 0x0000006e, .b = 7 }, |
| 132 | [ 84] = { .c = 0x0000006f, .b = 7 }, |
| 133 | [ 85] = { .c = 0x00000070, .b = 7 }, |
| 134 | [ 86] = { .c = 0x00000071, .b = 7 }, |
| 135 | [ 87] = { .c = 0x00000072, .b = 7 }, |
| 136 | [ 88] = { .c = 0x000000fc, .b = 8 }, |
| 137 | [ 89] = { .c = 0x00000073, .b = 7 }, |
| 138 | [ 90] = { .c = 0x000000fd, .b = 8 }, |
| 139 | [ 91] = { .c = 0x00001ffb, .b = 13 }, |
| 140 | [ 92] = { .c = 0x0007fff0, .b = 19 }, |
| 141 | [ 93] = { .c = 0x00001ffc, .b = 13 }, |
| 142 | [ 94] = { .c = 0x00003ffc, .b = 14 }, |
| 143 | [ 95] = { .c = 0x00000022, .b = 6 }, |
| 144 | [ 96] = { .c = 0x00007ffd, .b = 15 }, |
| 145 | [ 97] = { .c = 0x00000003, .b = 5 }, |
| 146 | [ 98] = { .c = 0x00000023, .b = 6 }, |
| 147 | [ 99] = { .c = 0x00000004, .b = 5 }, |
| 148 | [100] = { .c = 0x00000024, .b = 6 }, |
| 149 | [101] = { .c = 0x00000005, .b = 5 }, |
| 150 | [102] = { .c = 0x00000025, .b = 6 }, |
| 151 | [103] = { .c = 0x00000026, .b = 6 }, |
| 152 | [104] = { .c = 0x00000027, .b = 6 }, |
| 153 | [105] = { .c = 0x00000006, .b = 5 }, |
| 154 | [106] = { .c = 0x00000074, .b = 7 }, |
| 155 | [107] = { .c = 0x00000075, .b = 7 }, |
| 156 | [108] = { .c = 0x00000028, .b = 6 }, |
| 157 | [109] = { .c = 0x00000029, .b = 6 }, |
| 158 | [110] = { .c = 0x0000002a, .b = 6 }, |
| 159 | [111] = { .c = 0x00000007, .b = 5 }, |
| 160 | [112] = { .c = 0x0000002b, .b = 6 }, |
| 161 | [113] = { .c = 0x00000076, .b = 7 }, |
| 162 | [114] = { .c = 0x0000002c, .b = 6 }, |
| 163 | [115] = { .c = 0x00000008, .b = 5 }, |
| 164 | [116] = { .c = 0x00000009, .b = 5 }, |
| 165 | [117] = { .c = 0x0000002d, .b = 6 }, |
| 166 | [118] = { .c = 0x00000077, .b = 7 }, |
| 167 | [119] = { .c = 0x00000078, .b = 7 }, |
| 168 | [120] = { .c = 0x00000079, .b = 7 }, |
| 169 | [121] = { .c = 0x0000007a, .b = 7 }, |
| 170 | [122] = { .c = 0x0000007b, .b = 7 }, |
| 171 | [123] = { .c = 0x00007ffe, .b = 15 }, |
| 172 | [124] = { .c = 0x000007fc, .b = 11 }, |
| 173 | [125] = { .c = 0x00003ffd, .b = 14 }, |
| 174 | [126] = { .c = 0x00001ffd, .b = 13 }, |
| 175 | [127] = { .c = 0x0ffffffc, .b = 28 }, |
| 176 | [128] = { .c = 0x000fffe6, .b = 20 }, |
| 177 | [129] = { .c = 0x003fffd2, .b = 22 }, |
| 178 | [130] = { .c = 0x000fffe7, .b = 20 }, |
| 179 | [131] = { .c = 0x000fffe8, .b = 20 }, |
| 180 | [132] = { .c = 0x003fffd3, .b = 22 }, |
| 181 | [133] = { .c = 0x003fffd4, .b = 22 }, |
| 182 | [134] = { .c = 0x003fffd5, .b = 22 }, |
| 183 | [135] = { .c = 0x007fffd9, .b = 23 }, |
| 184 | [136] = { .c = 0x003fffd6, .b = 22 }, |
| 185 | [137] = { .c = 0x007fffda, .b = 23 }, |
| 186 | [138] = { .c = 0x007fffdb, .b = 23 }, |
| 187 | [139] = { .c = 0x007fffdc, .b = 23 }, |
| 188 | [140] = { .c = 0x007fffdd, .b = 23 }, |
| 189 | [141] = { .c = 0x007fffde, .b = 23 }, |
| 190 | [142] = { .c = 0x00ffffeb, .b = 24 }, |
| 191 | [143] = { .c = 0x007fffdf, .b = 23 }, |
| 192 | [144] = { .c = 0x00ffffec, .b = 24 }, |
| 193 | [145] = { .c = 0x00ffffed, .b = 24 }, |
| 194 | [146] = { .c = 0x003fffd7, .b = 22 }, |
| 195 | [147] = { .c = 0x007fffe0, .b = 23 }, |
| 196 | [148] = { .c = 0x00ffffee, .b = 24 }, |
| 197 | [149] = { .c = 0x007fffe1, .b = 23 }, |
| 198 | [150] = { .c = 0x007fffe2, .b = 23 }, |
| 199 | [151] = { .c = 0x007fffe3, .b = 23 }, |
| 200 | [152] = { .c = 0x007fffe4, .b = 23 }, |
| 201 | [153] = { .c = 0x001fffdc, .b = 21 }, |
| 202 | [154] = { .c = 0x003fffd8, .b = 22 }, |
| 203 | [155] = { .c = 0x007fffe5, .b = 23 }, |
| 204 | [156] = { .c = 0x003fffd9, .b = 22 }, |
| 205 | [157] = { .c = 0x007fffe6, .b = 23 }, |
| 206 | [158] = { .c = 0x007fffe7, .b = 23 }, |
| 207 | [159] = { .c = 0x00ffffef, .b = 24 }, |
| 208 | [160] = { .c = 0x003fffda, .b = 22 }, |
| 209 | [161] = { .c = 0x001fffdd, .b = 21 }, |
| 210 | [162] = { .c = 0x000fffe9, .b = 20 }, |
| 211 | [163] = { .c = 0x003fffdb, .b = 22 }, |
| 212 | [164] = { .c = 0x003fffdc, .b = 22 }, |
| 213 | [165] = { .c = 0x007fffe8, .b = 23 }, |
| 214 | [166] = { .c = 0x007fffe9, .b = 23 }, |
| 215 | [167] = { .c = 0x001fffde, .b = 21 }, |
| 216 | [168] = { .c = 0x007fffea, .b = 23 }, |
| 217 | [169] = { .c = 0x003fffdd, .b = 22 }, |
| 218 | [170] = { .c = 0x003fffde, .b = 22 }, |
| 219 | [171] = { .c = 0x00fffff0, .b = 24 }, |
| 220 | [172] = { .c = 0x001fffdf, .b = 21 }, |
| 221 | [173] = { .c = 0x003fffdf, .b = 22 }, |
| 222 | [174] = { .c = 0x007fffeb, .b = 23 }, |
| 223 | [175] = { .c = 0x007fffec, .b = 23 }, |
| 224 | [176] = { .c = 0x001fffe0, .b = 21 }, |
| 225 | [177] = { .c = 0x001fffe1, .b = 21 }, |
| 226 | [178] = { .c = 0x003fffe0, .b = 22 }, |
| 227 | [179] = { .c = 0x001fffe2, .b = 21 }, |
| 228 | [180] = { .c = 0x007fffed, .b = 23 }, |
| 229 | [181] = { .c = 0x003fffe1, .b = 22 }, |
| 230 | [182] = { .c = 0x007fffee, .b = 23 }, |
| 231 | [183] = { .c = 0x007fffef, .b = 23 }, |
| 232 | [184] = { .c = 0x000fffea, .b = 20 }, |
| 233 | [185] = { .c = 0x003fffe2, .b = 22 }, |
| 234 | [186] = { .c = 0x003fffe3, .b = 22 }, |
| 235 | [187] = { .c = 0x003fffe4, .b = 22 }, |
| 236 | [188] = { .c = 0x007ffff0, .b = 23 }, |
| 237 | [189] = { .c = 0x003fffe5, .b = 22 }, |
| 238 | [190] = { .c = 0x003fffe6, .b = 22 }, |
| 239 | [191] = { .c = 0x007ffff1, .b = 23 }, |
| 240 | [192] = { .c = 0x03ffffe0, .b = 26 }, |
| 241 | [193] = { .c = 0x03ffffe1, .b = 26 }, |
| 242 | [194] = { .c = 0x000fffeb, .b = 20 }, |
| 243 | [195] = { .c = 0x0007fff1, .b = 19 }, |
| 244 | [196] = { .c = 0x003fffe7, .b = 22 }, |
| 245 | [197] = { .c = 0x007ffff2, .b = 23 }, |
| 246 | [198] = { .c = 0x003fffe8, .b = 22 }, |
| 247 | [199] = { .c = 0x01ffffec, .b = 25 }, |
| 248 | [200] = { .c = 0x03ffffe2, .b = 26 }, |
| 249 | [201] = { .c = 0x03ffffe3, .b = 26 }, |
| 250 | [202] = { .c = 0x03ffffe4, .b = 26 }, |
| 251 | [203] = { .c = 0x07ffffde, .b = 27 }, |
| 252 | [204] = { .c = 0x07ffffdf, .b = 27 }, |
| 253 | [205] = { .c = 0x03ffffe5, .b = 26 }, |
| 254 | [206] = { .c = 0x00fffff1, .b = 24 }, |
| 255 | [207] = { .c = 0x01ffffed, .b = 25 }, |
| 256 | [208] = { .c = 0x0007fff2, .b = 19 }, |
| 257 | [209] = { .c = 0x001fffe3, .b = 21 }, |
| 258 | [210] = { .c = 0x03ffffe6, .b = 26 }, |
| 259 | [211] = { .c = 0x07ffffe0, .b = 27 }, |
| 260 | [212] = { .c = 0x07ffffe1, .b = 27 }, |
| 261 | [213] = { .c = 0x03ffffe7, .b = 26 }, |
| 262 | [214] = { .c = 0x07ffffe2, .b = 27 }, |
| 263 | [215] = { .c = 0x00fffff2, .b = 24 }, |
| 264 | [216] = { .c = 0x001fffe4, .b = 21 }, |
| 265 | [217] = { .c = 0x001fffe5, .b = 21 }, |
| 266 | [218] = { .c = 0x03ffffe8, .b = 26 }, |
| 267 | [219] = { .c = 0x03ffffe9, .b = 26 }, |
| 268 | [220] = { .c = 0x0ffffffd, .b = 28 }, |
| 269 | [221] = { .c = 0x07ffffe3, .b = 27 }, |
| 270 | [222] = { .c = 0x07ffffe4, .b = 27 }, |
| 271 | [223] = { .c = 0x07ffffe5, .b = 27 }, |
| 272 | [224] = { .c = 0x000fffec, .b = 20 }, |
| 273 | [225] = { .c = 0x00fffff3, .b = 24 }, |
| 274 | [226] = { .c = 0x000fffed, .b = 20 }, |
| 275 | [227] = { .c = 0x001fffe6, .b = 21 }, |
| 276 | [228] = { .c = 0x003fffe9, .b = 22 }, |
| 277 | [229] = { .c = 0x001fffe7, .b = 21 }, |
| 278 | [230] = { .c = 0x001fffe8, .b = 21 }, |
| 279 | [231] = { .c = 0x007ffff3, .b = 23 }, |
| 280 | [232] = { .c = 0x003fffea, .b = 22 }, |
| 281 | [233] = { .c = 0x003fffeb, .b = 22 }, |
| 282 | [234] = { .c = 0x01ffffee, .b = 25 }, |
| 283 | [235] = { .c = 0x01ffffef, .b = 25 }, |
| 284 | [236] = { .c = 0x00fffff4, .b = 24 }, |
| 285 | [237] = { .c = 0x00fffff5, .b = 24 }, |
| 286 | [238] = { .c = 0x03ffffea, .b = 26 }, |
| 287 | [239] = { .c = 0x007ffff4, .b = 23 }, |
| 288 | [240] = { .c = 0x03ffffeb, .b = 26 }, |
| 289 | [241] = { .c = 0x07ffffe6, .b = 27 }, |
| 290 | [242] = { .c = 0x03ffffec, .b = 26 }, |
| 291 | [243] = { .c = 0x03ffffed, .b = 26 }, |
| 292 | [244] = { .c = 0x07ffffe7, .b = 27 }, |
| 293 | [245] = { .c = 0x07ffffe8, .b = 27 }, |
| 294 | [246] = { .c = 0x07ffffe9, .b = 27 }, |
| 295 | [247] = { .c = 0x07ffffea, .b = 27 }, |
| 296 | [248] = { .c = 0x07ffffeb, .b = 27 }, |
| 297 | [249] = { .c = 0x0ffffffe, .b = 28 }, |
| 298 | [250] = { .c = 0x07ffffec, .b = 27 }, |
| 299 | [251] = { .c = 0x07ffffed, .b = 27 }, |
| 300 | [252] = { .c = 0x07ffffee, .b = 27 }, |
| 301 | [253] = { .c = 0x07ffffef, .b = 27 }, |
| 302 | [254] = { .c = 0x07fffff0, .b = 27 }, |
| 303 | [255] = { .c = 0x03ffffee, .b = 26 }, |
| 304 | [256] = { .c = 0x3fffffff, .b = 30 }, /* EOS */ |
| 305 | }; |
| 306 | |
| 307 | |
Willy Tarreau | 074ebcd | 2021-04-02 13:31:46 +0200 | [diff] [blame] | 308 | /* Reversed huffman codes, generated by dev/hpack/gen-rht.c from the table |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 309 | * above. |
| 310 | * |
| 311 | * The codes are aligned on the MSB since that's how they appear in the stream. |
| 312 | * |
| 313 | * Quick summary below of the way the tables work. They're based on how the |
| 314 | * prefixes are organized, starting from the MSB. |
| 315 | * |
| 316 | * These codes fit in a single octet (5 to 8 bits) : |
| 317 | * 00/5 08/5 10/5 18/5 20/5 28/5 30/5 38/5 |
| 318 | * 40/5 48/5 |
| 319 | * |
| 320 | * 50/6 54/6 58/6 5c/6 60/6 64/6 68/6 6c/6 |
| 321 | * 70/6 74/6 78/6 7c/6 80/6 84/6 88/6 8c/6 |
| 322 | * 90/6 94/6 98/6 9c/6 a0/6 a4/6 a8/6 ac/6 |
| 323 | * b0/6 b4/6 |
| 324 | * |
| 325 | * b8/7 ba/7 bc/7 be/7 c0/7 c2/7 c4/7 c6/7 |
| 326 | * c8/7 ca/7 cc/7 ce/7 d0/7 d2/7 d4/7 d6/7 |
| 327 | * d8/7 da/7 dc/7 de/7 e0/7 e2/7 e4/7 e6/7 |
| 328 | * e8/7 ea/7 ec/7 ee/7 f0/7 f2/7 f4/7 f6/7 |
| 329 | * |
| 330 | * f8/8 f9/8 fa/8 fb/8 fc/8 fd/8 |
| 331 | * |
| 332 | * ==> a single 256-symbol table based on the full byte provides a direct |
| 333 | * access and the bit count |
| 334 | * |
| 335 | * These codes fit in two octets (10 to 15 bits, neither 9 nor 16 bits code) : |
| 336 | * |
| 337 | * fe + 2 bits: |
| 338 | * 00/2 40/2 80/2 c0/2 |
| 339 | * |
| 340 | * ff + 2..7 bits : |
| 341 | * 00/2 |
| 342 | * 40/3 60/3 80/3 |
| 343 | * a0/4 b0/4 |
| 344 | * c0/5 c8/5 d0/5 d8/5 e0/5 e8/5 |
| 345 | * f0/6 f4/6 |
| 346 | * f8/7 fa/7 fc/7 |
| 347 | * |
| 348 | * ==> a single 256-symbol table made of b0.0 and b1.7-1 provides a direct |
| 349 | * access and the bit count after a miss on the first one above. |
| 350 | * |
| 351 | * These ones fit in three octets : |
| 352 | * ff fe + 3..5 bits : |
| 353 | * 00/3 20/3 40/3 60/4 70/4 80/4 90/4 a0/4 |
| 354 | * b0/4 c0/4 d0/4 |
| 355 | * e0/5 e8/5 f0/5 f8/5 |
| 356 | * |
| 357 | * ff ff + 5..8 bits : |
| 358 | * 00/5 08/5 10/5 18/5 20/5 28/5 30/5 38/5 |
| 359 | * 40/5 |
| 360 | * 48/6 4c/6 50/6 54/6 58/6 5c/6 60/6 64/6 |
| 361 | * 68/6 6c/6 70/6 74/6 78/6 7c/6 80/6 84/6 |
| 362 | * 88/6 8c/6 90/6 94/6 98/6 9c/6 a0/6 a4/6 |
| 363 | * a8/6 ac/6 |
| 364 | * b0/7 b2/7 b4/7 b6/7 b8/7 ba/7 bc/7 be/7 |
| 365 | * c0/7 c2/7 c4/7 c6/7 c8/7 ca/7 cc/7 ce/7 |
| 366 | * d0/7 d2/7 d4/7 d6/7 d8/7 da/7 dc/7 de/7 |
| 367 | * e0/7 e2/7 e4/7 e6/7 e8/7 |
| 368 | * ea/8 eb/8 ec/8 ed/8 ee/8 ef/8 f0/8 f1/8 |
| 369 | * f2/8 f3/8 f4/8 f5/8 |
| 370 | * |
| 371 | * ==> a 32-symbol table has to be applied to 0xfffe |
| 372 | * ==> a 256-symbol table has to be applied to 0xffff |
| 373 | * |
| 374 | * The other ones fit in four octets with 1 to 6 bits in the last one : |
| 375 | * ff ff f6 : 00/1 80/1 |
| 376 | * ff ff f7 : 00/1 80/1 |
| 377 | * ff ff f8 : 00/2 40/2 80/2 c0/2 |
| 378 | * ff ff f9 : 00/2 40/2 80/2 c0/2 |
| 379 | * ff ff fa : 00/2 40/2 80/2 c0/2 |
| 380 | * ff ff fb : 00/2 40/2 80/2 |
| 381 | * ff ff fb : c0/3 e0/3 |
| 382 | * ff ff fc : 00/3 20/3 40/3 60/3 80/3 a0/3 c0/3 e0/3 |
| 383 | * ff ff fd : 00/3 20/3 40/3 60/3 80/3 a0/3 c0/3 e0/3 |
| 384 | * ff ff fe : 00/3 |
| 385 | * ff ff fe : 20/4 30/4 40/4 50/4 60/4 70/4 80/4 90/4 a0/4 b0/4 c0/4 d0/4 e0/4 f0/4 |
| 386 | * ff ff ff : 00/4 10/4 20/4 30/4 40/4 50/4 60/4 70/4 80/4 90/4 a0/4 b0/4 c0/4 d0/4 e0/4 |
| 387 | * ff ff ff : f0/6 f4/6 f8/6 fc/6 |
| 388 | * |
| 389 | * ==> a 256-symbol table with b2.0-3,b3.7-4 gives all of them except the |
| 390 | * distinction between ffffff{f0,f4,f8,fc} which is rare enough |
| 391 | * and can be done by hand when bit count == 30. |
| 392 | * |
| 393 | * |
| 394 | * Code lengths : |
| 395 | * 5..8 : 0x00..0xfe |
| 396 | * 10..15 : 0xfe |
| 397 | * 0xff 0x00..0xfe |
| 398 | * 19..20 : 0xff 0xfe 0x00..0xdf |
| 399 | * 21 : 0xff 0xfe 0xe0..0xff |
| 400 | * 21 : 0xff 0xff 0x00..0x40 |
| 401 | * 22..24 : 0xff 0xff 0x00..0xf5 |
| 402 | * 24..28 : 0xff 0xff 0xf5..0xff |
| 403 | * 30 : 0xff 0xff 0xff 0xf0..0xff |
| 404 | * |
| 405 | * |
| 406 | * if b0 < 0xfe ==> 5..8 bits (74 codes) |
| 407 | * if b0 == 0xfe or 0xff : 10..15 |
| 408 | * => if b0 == 0xfe || b1 < 0xfe : lookup (b0:0|b1:7..1) (21 codes) |
| 409 | * |
| 410 | * -- b0 = 0xff -- |
| 411 | * if b1 == 0xfe : 19..21 bits |
| 412 | * => lookup b2:7..3 (15 codes) |
| 413 | * |
| 414 | * -- b0 = 0xff, b1 = 0xff : 147 codes -- |
| 415 | * if b2 < 0xf6 : 21..24 bits (76 codes) |
| 416 | * if b2 >= 0xf6 : 25..30 bits (71 codes) |
| 417 | * |
| 418 | * Algorithm: |
| 419 | * - if > 24 and < 32, read missing bits. |
| 420 | * - if less than 24 bits, read 1 byte. If past end, insert 0xff instead. |
| 421 | * - if b0 < 0xfe lookup b0 in table0[0..255] |
| 422 | * - else if b0 == 0xfe, manual lookup |
| 423 | * - else if b0 == 0xff, lookup b1 in table1[0..255] |
| 424 | * ... |
| 425 | */ |
| 426 | |
| 427 | struct rht rht_bit31_24[256] = { |
| 428 | [0x00] = { .c = 0x30, .l = 5 }, |
| 429 | [0x01] = { .c = 0x30, .l = 5 }, |
| 430 | [0x02] = { .c = 0x30, .l = 5 }, |
| 431 | [0x03] = { .c = 0x30, .l = 5 }, |
| 432 | [0x04] = { .c = 0x30, .l = 5 }, |
| 433 | [0x05] = { .c = 0x30, .l = 5 }, |
| 434 | [0x06] = { .c = 0x30, .l = 5 }, |
| 435 | [0x07] = { .c = 0x30, .l = 5 }, |
| 436 | [0x08] = { .c = 0x31, .l = 5 }, |
| 437 | [0x09] = { .c = 0x31, .l = 5 }, |
| 438 | [0x0a] = { .c = 0x31, .l = 5 }, |
| 439 | [0x0b] = { .c = 0x31, .l = 5 }, |
| 440 | [0x0c] = { .c = 0x31, .l = 5 }, |
| 441 | [0x0d] = { .c = 0x31, .l = 5 }, |
| 442 | [0x0e] = { .c = 0x31, .l = 5 }, |
| 443 | [0x0f] = { .c = 0x31, .l = 5 }, |
| 444 | [0x10] = { .c = 0x32, .l = 5 }, |
| 445 | [0x11] = { .c = 0x32, .l = 5 }, |
| 446 | [0x12] = { .c = 0x32, .l = 5 }, |
| 447 | [0x13] = { .c = 0x32, .l = 5 }, |
| 448 | [0x14] = { .c = 0x32, .l = 5 }, |
| 449 | [0x15] = { .c = 0x32, .l = 5 }, |
| 450 | [0x16] = { .c = 0x32, .l = 5 }, |
| 451 | [0x17] = { .c = 0x32, .l = 5 }, |
| 452 | [0x18] = { .c = 0x61, .l = 5 }, |
| 453 | [0x19] = { .c = 0x61, .l = 5 }, |
| 454 | [0x1a] = { .c = 0x61, .l = 5 }, |
| 455 | [0x1b] = { .c = 0x61, .l = 5 }, |
| 456 | [0x1c] = { .c = 0x61, .l = 5 }, |
| 457 | [0x1d] = { .c = 0x61, .l = 5 }, |
| 458 | [0x1e] = { .c = 0x61, .l = 5 }, |
| 459 | [0x1f] = { .c = 0x61, .l = 5 }, |
| 460 | [0x20] = { .c = 0x63, .l = 5 }, |
| 461 | [0x21] = { .c = 0x63, .l = 5 }, |
| 462 | [0x22] = { .c = 0x63, .l = 5 }, |
| 463 | [0x23] = { .c = 0x63, .l = 5 }, |
| 464 | [0x24] = { .c = 0x63, .l = 5 }, |
| 465 | [0x25] = { .c = 0x63, .l = 5 }, |
| 466 | [0x26] = { .c = 0x63, .l = 5 }, |
| 467 | [0x27] = { .c = 0x63, .l = 5 }, |
| 468 | [0x28] = { .c = 0x65, .l = 5 }, |
| 469 | [0x29] = { .c = 0x65, .l = 5 }, |
| 470 | [0x2a] = { .c = 0x65, .l = 5 }, |
| 471 | [0x2b] = { .c = 0x65, .l = 5 }, |
| 472 | [0x2c] = { .c = 0x65, .l = 5 }, |
| 473 | [0x2d] = { .c = 0x65, .l = 5 }, |
| 474 | [0x2e] = { .c = 0x65, .l = 5 }, |
| 475 | [0x2f] = { .c = 0x65, .l = 5 }, |
| 476 | [0x30] = { .c = 0x69, .l = 5 }, |
| 477 | [0x31] = { .c = 0x69, .l = 5 }, |
| 478 | [0x32] = { .c = 0x69, .l = 5 }, |
| 479 | [0x33] = { .c = 0x69, .l = 5 }, |
| 480 | [0x34] = { .c = 0x69, .l = 5 }, |
| 481 | [0x35] = { .c = 0x69, .l = 5 }, |
| 482 | [0x36] = { .c = 0x69, .l = 5 }, |
| 483 | [0x37] = { .c = 0x69, .l = 5 }, |
| 484 | [0x38] = { .c = 0x6f, .l = 5 }, |
| 485 | [0x39] = { .c = 0x6f, .l = 5 }, |
| 486 | [0x3a] = { .c = 0x6f, .l = 5 }, |
| 487 | [0x3b] = { .c = 0x6f, .l = 5 }, |
| 488 | [0x3c] = { .c = 0x6f, .l = 5 }, |
| 489 | [0x3d] = { .c = 0x6f, .l = 5 }, |
| 490 | [0x3e] = { .c = 0x6f, .l = 5 }, |
| 491 | [0x3f] = { .c = 0x6f, .l = 5 }, |
| 492 | [0x40] = { .c = 0x73, .l = 5 }, |
| 493 | [0x41] = { .c = 0x73, .l = 5 }, |
| 494 | [0x42] = { .c = 0x73, .l = 5 }, |
| 495 | [0x43] = { .c = 0x73, .l = 5 }, |
| 496 | [0x44] = { .c = 0x73, .l = 5 }, |
| 497 | [0x45] = { .c = 0x73, .l = 5 }, |
| 498 | [0x46] = { .c = 0x73, .l = 5 }, |
| 499 | [0x47] = { .c = 0x73, .l = 5 }, |
| 500 | [0x48] = { .c = 0x74, .l = 5 }, |
| 501 | [0x49] = { .c = 0x74, .l = 5 }, |
| 502 | [0x4a] = { .c = 0x74, .l = 5 }, |
| 503 | [0x4b] = { .c = 0x74, .l = 5 }, |
| 504 | [0x4c] = { .c = 0x74, .l = 5 }, |
| 505 | [0x4d] = { .c = 0x74, .l = 5 }, |
| 506 | [0x4e] = { .c = 0x74, .l = 5 }, |
| 507 | [0x4f] = { .c = 0x74, .l = 5 }, |
| 508 | [0x50] = { .c = 0x20, .l = 6 }, |
| 509 | [0x51] = { .c = 0x20, .l = 6 }, |
| 510 | [0x52] = { .c = 0x20, .l = 6 }, |
| 511 | [0x53] = { .c = 0x20, .l = 6 }, |
| 512 | [0x54] = { .c = 0x25, .l = 6 }, |
| 513 | [0x55] = { .c = 0x25, .l = 6 }, |
| 514 | [0x56] = { .c = 0x25, .l = 6 }, |
| 515 | [0x57] = { .c = 0x25, .l = 6 }, |
| 516 | [0x58] = { .c = 0x2d, .l = 6 }, |
| 517 | [0x59] = { .c = 0x2d, .l = 6 }, |
| 518 | [0x5a] = { .c = 0x2d, .l = 6 }, |
| 519 | [0x5b] = { .c = 0x2d, .l = 6 }, |
| 520 | [0x5c] = { .c = 0x2e, .l = 6 }, |
| 521 | [0x5d] = { .c = 0x2e, .l = 6 }, |
| 522 | [0x5e] = { .c = 0x2e, .l = 6 }, |
| 523 | [0x5f] = { .c = 0x2e, .l = 6 }, |
| 524 | [0x60] = { .c = 0x2f, .l = 6 }, |
| 525 | [0x61] = { .c = 0x2f, .l = 6 }, |
| 526 | [0x62] = { .c = 0x2f, .l = 6 }, |
| 527 | [0x63] = { .c = 0x2f, .l = 6 }, |
| 528 | [0x64] = { .c = 0x33, .l = 6 }, |
| 529 | [0x65] = { .c = 0x33, .l = 6 }, |
| 530 | [0x66] = { .c = 0x33, .l = 6 }, |
| 531 | [0x67] = { .c = 0x33, .l = 6 }, |
| 532 | [0x68] = { .c = 0x34, .l = 6 }, |
| 533 | [0x69] = { .c = 0x34, .l = 6 }, |
| 534 | [0x6a] = { .c = 0x34, .l = 6 }, |
| 535 | [0x6b] = { .c = 0x34, .l = 6 }, |
| 536 | [0x6c] = { .c = 0x35, .l = 6 }, |
| 537 | [0x6d] = { .c = 0x35, .l = 6 }, |
| 538 | [0x6e] = { .c = 0x35, .l = 6 }, |
| 539 | [0x6f] = { .c = 0x35, .l = 6 }, |
| 540 | [0x70] = { .c = 0x36, .l = 6 }, |
| 541 | [0x71] = { .c = 0x36, .l = 6 }, |
| 542 | [0x72] = { .c = 0x36, .l = 6 }, |
| 543 | [0x73] = { .c = 0x36, .l = 6 }, |
| 544 | [0x74] = { .c = 0x37, .l = 6 }, |
| 545 | [0x75] = { .c = 0x37, .l = 6 }, |
| 546 | [0x76] = { .c = 0x37, .l = 6 }, |
| 547 | [0x77] = { .c = 0x37, .l = 6 }, |
| 548 | [0x78] = { .c = 0x38, .l = 6 }, |
| 549 | [0x79] = { .c = 0x38, .l = 6 }, |
| 550 | [0x7a] = { .c = 0x38, .l = 6 }, |
| 551 | [0x7b] = { .c = 0x38, .l = 6 }, |
| 552 | [0x7c] = { .c = 0x39, .l = 6 }, |
| 553 | [0x7d] = { .c = 0x39, .l = 6 }, |
| 554 | [0x7e] = { .c = 0x39, .l = 6 }, |
| 555 | [0x7f] = { .c = 0x39, .l = 6 }, |
| 556 | [0x80] = { .c = 0x3d, .l = 6 }, |
| 557 | [0x81] = { .c = 0x3d, .l = 6 }, |
| 558 | [0x82] = { .c = 0x3d, .l = 6 }, |
| 559 | [0x83] = { .c = 0x3d, .l = 6 }, |
| 560 | [0x84] = { .c = 0x41, .l = 6 }, |
| 561 | [0x85] = { .c = 0x41, .l = 6 }, |
| 562 | [0x86] = { .c = 0x41, .l = 6 }, |
| 563 | [0x87] = { .c = 0x41, .l = 6 }, |
| 564 | [0x88] = { .c = 0x5f, .l = 6 }, |
| 565 | [0x89] = { .c = 0x5f, .l = 6 }, |
| 566 | [0x8a] = { .c = 0x5f, .l = 6 }, |
| 567 | [0x8b] = { .c = 0x5f, .l = 6 }, |
| 568 | [0x8c] = { .c = 0x62, .l = 6 }, |
| 569 | [0x8d] = { .c = 0x62, .l = 6 }, |
| 570 | [0x8e] = { .c = 0x62, .l = 6 }, |
| 571 | [0x8f] = { .c = 0x62, .l = 6 }, |
| 572 | [0x90] = { .c = 0x64, .l = 6 }, |
| 573 | [0x91] = { .c = 0x64, .l = 6 }, |
| 574 | [0x92] = { .c = 0x64, .l = 6 }, |
| 575 | [0x93] = { .c = 0x64, .l = 6 }, |
| 576 | [0x94] = { .c = 0x66, .l = 6 }, |
| 577 | [0x95] = { .c = 0x66, .l = 6 }, |
| 578 | [0x96] = { .c = 0x66, .l = 6 }, |
| 579 | [0x97] = { .c = 0x66, .l = 6 }, |
| 580 | [0x98] = { .c = 0x67, .l = 6 }, |
| 581 | [0x99] = { .c = 0x67, .l = 6 }, |
| 582 | [0x9a] = { .c = 0x67, .l = 6 }, |
| 583 | [0x9b] = { .c = 0x67, .l = 6 }, |
| 584 | [0x9c] = { .c = 0x68, .l = 6 }, |
| 585 | [0x9d] = { .c = 0x68, .l = 6 }, |
| 586 | [0x9e] = { .c = 0x68, .l = 6 }, |
| 587 | [0x9f] = { .c = 0x68, .l = 6 }, |
| 588 | [0xa0] = { .c = 0x6c, .l = 6 }, |
| 589 | [0xa1] = { .c = 0x6c, .l = 6 }, |
| 590 | [0xa2] = { .c = 0x6c, .l = 6 }, |
| 591 | [0xa3] = { .c = 0x6c, .l = 6 }, |
| 592 | [0xa4] = { .c = 0x6d, .l = 6 }, |
| 593 | [0xa5] = { .c = 0x6d, .l = 6 }, |
| 594 | [0xa6] = { .c = 0x6d, .l = 6 }, |
| 595 | [0xa7] = { .c = 0x6d, .l = 6 }, |
| 596 | [0xa8] = { .c = 0x6e, .l = 6 }, |
| 597 | [0xa9] = { .c = 0x6e, .l = 6 }, |
| 598 | [0xaa] = { .c = 0x6e, .l = 6 }, |
| 599 | [0xab] = { .c = 0x6e, .l = 6 }, |
| 600 | [0xac] = { .c = 0x70, .l = 6 }, |
| 601 | [0xad] = { .c = 0x70, .l = 6 }, |
| 602 | [0xae] = { .c = 0x70, .l = 6 }, |
| 603 | [0xaf] = { .c = 0x70, .l = 6 }, |
| 604 | [0xb0] = { .c = 0x72, .l = 6 }, |
| 605 | [0xb1] = { .c = 0x72, .l = 6 }, |
| 606 | [0xb2] = { .c = 0x72, .l = 6 }, |
| 607 | [0xb3] = { .c = 0x72, .l = 6 }, |
| 608 | [0xb4] = { .c = 0x75, .l = 6 }, |
| 609 | [0xb5] = { .c = 0x75, .l = 6 }, |
| 610 | [0xb6] = { .c = 0x75, .l = 6 }, |
| 611 | [0xb7] = { .c = 0x75, .l = 6 }, |
| 612 | [0xb8] = { .c = 0x3a, .l = 7 }, |
| 613 | [0xb9] = { .c = 0x3a, .l = 7 }, |
| 614 | [0xba] = { .c = 0x42, .l = 7 }, |
| 615 | [0xbb] = { .c = 0x42, .l = 7 }, |
| 616 | [0xbc] = { .c = 0x43, .l = 7 }, |
| 617 | [0xbd] = { .c = 0x43, .l = 7 }, |
| 618 | [0xbe] = { .c = 0x44, .l = 7 }, |
| 619 | [0xbf] = { .c = 0x44, .l = 7 }, |
| 620 | [0xc0] = { .c = 0x45, .l = 7 }, |
| 621 | [0xc1] = { .c = 0x45, .l = 7 }, |
| 622 | [0xc2] = { .c = 0x46, .l = 7 }, |
| 623 | [0xc3] = { .c = 0x46, .l = 7 }, |
| 624 | [0xc4] = { .c = 0x47, .l = 7 }, |
| 625 | [0xc5] = { .c = 0x47, .l = 7 }, |
| 626 | [0xc6] = { .c = 0x48, .l = 7 }, |
| 627 | [0xc7] = { .c = 0x48, .l = 7 }, |
| 628 | [0xc8] = { .c = 0x49, .l = 7 }, |
| 629 | [0xc9] = { .c = 0x49, .l = 7 }, |
| 630 | [0xca] = { .c = 0x4a, .l = 7 }, |
| 631 | [0xcb] = { .c = 0x4a, .l = 7 }, |
| 632 | [0xcc] = { .c = 0x4b, .l = 7 }, |
| 633 | [0xcd] = { .c = 0x4b, .l = 7 }, |
| 634 | [0xce] = { .c = 0x4c, .l = 7 }, |
| 635 | [0xcf] = { .c = 0x4c, .l = 7 }, |
| 636 | [0xd0] = { .c = 0x4d, .l = 7 }, |
| 637 | [0xd1] = { .c = 0x4d, .l = 7 }, |
| 638 | [0xd2] = { .c = 0x4e, .l = 7 }, |
| 639 | [0xd3] = { .c = 0x4e, .l = 7 }, |
| 640 | [0xd4] = { .c = 0x4f, .l = 7 }, |
| 641 | [0xd5] = { .c = 0x4f, .l = 7 }, |
| 642 | [0xd6] = { .c = 0x50, .l = 7 }, |
| 643 | [0xd7] = { .c = 0x50, .l = 7 }, |
| 644 | [0xd8] = { .c = 0x51, .l = 7 }, |
| 645 | [0xd9] = { .c = 0x51, .l = 7 }, |
| 646 | [0xda] = { .c = 0x52, .l = 7 }, |
| 647 | [0xdb] = { .c = 0x52, .l = 7 }, |
| 648 | [0xdc] = { .c = 0x53, .l = 7 }, |
| 649 | [0xdd] = { .c = 0x53, .l = 7 }, |
| 650 | [0xde] = { .c = 0x54, .l = 7 }, |
| 651 | [0xdf] = { .c = 0x54, .l = 7 }, |
| 652 | [0xe0] = { .c = 0x55, .l = 7 }, |
| 653 | [0xe1] = { .c = 0x55, .l = 7 }, |
| 654 | [0xe2] = { .c = 0x56, .l = 7 }, |
| 655 | [0xe3] = { .c = 0x56, .l = 7 }, |
| 656 | [0xe4] = { .c = 0x57, .l = 7 }, |
| 657 | [0xe5] = { .c = 0x57, .l = 7 }, |
| 658 | [0xe6] = { .c = 0x59, .l = 7 }, |
| 659 | [0xe7] = { .c = 0x59, .l = 7 }, |
| 660 | [0xe8] = { .c = 0x6a, .l = 7 }, |
| 661 | [0xe9] = { .c = 0x6a, .l = 7 }, |
| 662 | [0xea] = { .c = 0x6b, .l = 7 }, |
| 663 | [0xeb] = { .c = 0x6b, .l = 7 }, |
| 664 | [0xec] = { .c = 0x71, .l = 7 }, |
| 665 | [0xed] = { .c = 0x71, .l = 7 }, |
| 666 | [0xee] = { .c = 0x76, .l = 7 }, |
| 667 | [0xef] = { .c = 0x76, .l = 7 }, |
| 668 | [0xf0] = { .c = 0x77, .l = 7 }, |
| 669 | [0xf1] = { .c = 0x77, .l = 7 }, |
| 670 | [0xf2] = { .c = 0x78, .l = 7 }, |
| 671 | [0xf3] = { .c = 0x78, .l = 7 }, |
| 672 | [0xf4] = { .c = 0x79, .l = 7 }, |
| 673 | [0xf5] = { .c = 0x79, .l = 7 }, |
| 674 | [0xf6] = { .c = 0x7a, .l = 7 }, |
| 675 | [0xf7] = { .c = 0x7a, .l = 7 }, |
| 676 | [0xf8] = { .c = 0x26, .l = 8 }, |
| 677 | [0xf9] = { .c = 0x2a, .l = 8 }, |
| 678 | [0xfa] = { .c = 0x2c, .l = 8 }, |
| 679 | [0xfb] = { .c = 0x3b, .l = 8 }, |
| 680 | [0xfc] = { .c = 0x58, .l = 8 }, |
| 681 | [0xfd] = { .c = 0x5a, .l = 8 }, |
| 682 | }; |
| 683 | |
| 684 | struct rht rht_bit24_17[256] = { |
| 685 | [0x00] = { .c = 0x21, .l = 10 }, |
| 686 | [0x01] = { .c = 0x21, .l = 10 }, |
| 687 | [0x02] = { .c = 0x21, .l = 10 }, |
| 688 | [0x03] = { .c = 0x21, .l = 10 }, |
| 689 | [0x04] = { .c = 0x21, .l = 10 }, |
| 690 | [0x05] = { .c = 0x21, .l = 10 }, |
| 691 | [0x06] = { .c = 0x21, .l = 10 }, |
| 692 | [0x07] = { .c = 0x21, .l = 10 }, |
| 693 | [0x08] = { .c = 0x21, .l = 10 }, |
| 694 | [0x09] = { .c = 0x21, .l = 10 }, |
| 695 | [0x0a] = { .c = 0x21, .l = 10 }, |
| 696 | [0x0b] = { .c = 0x21, .l = 10 }, |
| 697 | [0x0c] = { .c = 0x21, .l = 10 }, |
| 698 | [0x0d] = { .c = 0x21, .l = 10 }, |
| 699 | [0x0e] = { .c = 0x21, .l = 10 }, |
| 700 | [0x0f] = { .c = 0x21, .l = 10 }, |
| 701 | [0x10] = { .c = 0x21, .l = 10 }, |
| 702 | [0x11] = { .c = 0x21, .l = 10 }, |
| 703 | [0x12] = { .c = 0x21, .l = 10 }, |
| 704 | [0x13] = { .c = 0x21, .l = 10 }, |
| 705 | [0x14] = { .c = 0x21, .l = 10 }, |
| 706 | [0x15] = { .c = 0x21, .l = 10 }, |
| 707 | [0x16] = { .c = 0x21, .l = 10 }, |
| 708 | [0x17] = { .c = 0x21, .l = 10 }, |
| 709 | [0x18] = { .c = 0x21, .l = 10 }, |
| 710 | [0x19] = { .c = 0x21, .l = 10 }, |
| 711 | [0x1a] = { .c = 0x21, .l = 10 }, |
| 712 | [0x1b] = { .c = 0x21, .l = 10 }, |
| 713 | [0x1c] = { .c = 0x21, .l = 10 }, |
| 714 | [0x1d] = { .c = 0x21, .l = 10 }, |
| 715 | [0x1e] = { .c = 0x21, .l = 10 }, |
| 716 | [0x1f] = { .c = 0x21, .l = 10 }, |
| 717 | [0x20] = { .c = 0x22, .l = 10 }, |
| 718 | [0x21] = { .c = 0x22, .l = 10 }, |
| 719 | [0x22] = { .c = 0x22, .l = 10 }, |
| 720 | [0x23] = { .c = 0x22, .l = 10 }, |
| 721 | [0x24] = { .c = 0x22, .l = 10 }, |
| 722 | [0x25] = { .c = 0x22, .l = 10 }, |
| 723 | [0x26] = { .c = 0x22, .l = 10 }, |
| 724 | [0x27] = { .c = 0x22, .l = 10 }, |
| 725 | [0x28] = { .c = 0x22, .l = 10 }, |
| 726 | [0x29] = { .c = 0x22, .l = 10 }, |
| 727 | [0x2a] = { .c = 0x22, .l = 10 }, |
| 728 | [0x2b] = { .c = 0x22, .l = 10 }, |
| 729 | [0x2c] = { .c = 0x22, .l = 10 }, |
| 730 | [0x2d] = { .c = 0x22, .l = 10 }, |
| 731 | [0x2e] = { .c = 0x22, .l = 10 }, |
| 732 | [0x2f] = { .c = 0x22, .l = 10 }, |
| 733 | [0x30] = { .c = 0x22, .l = 10 }, |
| 734 | [0x31] = { .c = 0x22, .l = 10 }, |
| 735 | [0x32] = { .c = 0x22, .l = 10 }, |
| 736 | [0x33] = { .c = 0x22, .l = 10 }, |
| 737 | [0x34] = { .c = 0x22, .l = 10 }, |
| 738 | [0x35] = { .c = 0x22, .l = 10 }, |
| 739 | [0x36] = { .c = 0x22, .l = 10 }, |
| 740 | [0x37] = { .c = 0x22, .l = 10 }, |
| 741 | [0x38] = { .c = 0x22, .l = 10 }, |
| 742 | [0x39] = { .c = 0x22, .l = 10 }, |
| 743 | [0x3a] = { .c = 0x22, .l = 10 }, |
| 744 | [0x3b] = { .c = 0x22, .l = 10 }, |
| 745 | [0x3c] = { .c = 0x22, .l = 10 }, |
| 746 | [0x3d] = { .c = 0x22, .l = 10 }, |
| 747 | [0x3e] = { .c = 0x22, .l = 10 }, |
| 748 | [0x3f] = { .c = 0x22, .l = 10 }, |
| 749 | [0x40] = { .c = 0x28, .l = 10 }, |
| 750 | [0x41] = { .c = 0x28, .l = 10 }, |
| 751 | [0x42] = { .c = 0x28, .l = 10 }, |
| 752 | [0x43] = { .c = 0x28, .l = 10 }, |
| 753 | [0x44] = { .c = 0x28, .l = 10 }, |
| 754 | [0x45] = { .c = 0x28, .l = 10 }, |
| 755 | [0x46] = { .c = 0x28, .l = 10 }, |
| 756 | [0x47] = { .c = 0x28, .l = 10 }, |
| 757 | [0x48] = { .c = 0x28, .l = 10 }, |
| 758 | [0x49] = { .c = 0x28, .l = 10 }, |
| 759 | [0x4a] = { .c = 0x28, .l = 10 }, |
| 760 | [0x4b] = { .c = 0x28, .l = 10 }, |
| 761 | [0x4c] = { .c = 0x28, .l = 10 }, |
| 762 | [0x4d] = { .c = 0x28, .l = 10 }, |
| 763 | [0x4e] = { .c = 0x28, .l = 10 }, |
| 764 | [0x4f] = { .c = 0x28, .l = 10 }, |
| 765 | [0x50] = { .c = 0x28, .l = 10 }, |
| 766 | [0x51] = { .c = 0x28, .l = 10 }, |
| 767 | [0x52] = { .c = 0x28, .l = 10 }, |
| 768 | [0x53] = { .c = 0x28, .l = 10 }, |
| 769 | [0x54] = { .c = 0x28, .l = 10 }, |
| 770 | [0x55] = { .c = 0x28, .l = 10 }, |
| 771 | [0x56] = { .c = 0x28, .l = 10 }, |
| 772 | [0x57] = { .c = 0x28, .l = 10 }, |
| 773 | [0x58] = { .c = 0x28, .l = 10 }, |
| 774 | [0x59] = { .c = 0x28, .l = 10 }, |
| 775 | [0x5a] = { .c = 0x28, .l = 10 }, |
| 776 | [0x5b] = { .c = 0x28, .l = 10 }, |
| 777 | [0x5c] = { .c = 0x28, .l = 10 }, |
| 778 | [0x5d] = { .c = 0x28, .l = 10 }, |
| 779 | [0x5e] = { .c = 0x28, .l = 10 }, |
| 780 | [0x5f] = { .c = 0x28, .l = 10 }, |
| 781 | [0x60] = { .c = 0x29, .l = 10 }, |
| 782 | [0x61] = { .c = 0x29, .l = 10 }, |
| 783 | [0x62] = { .c = 0x29, .l = 10 }, |
| 784 | [0x63] = { .c = 0x29, .l = 10 }, |
| 785 | [0x64] = { .c = 0x29, .l = 10 }, |
| 786 | [0x65] = { .c = 0x29, .l = 10 }, |
| 787 | [0x66] = { .c = 0x29, .l = 10 }, |
| 788 | [0x67] = { .c = 0x29, .l = 10 }, |
| 789 | [0x68] = { .c = 0x29, .l = 10 }, |
| 790 | [0x69] = { .c = 0x29, .l = 10 }, |
| 791 | [0x6a] = { .c = 0x29, .l = 10 }, |
| 792 | [0x6b] = { .c = 0x29, .l = 10 }, |
| 793 | [0x6c] = { .c = 0x29, .l = 10 }, |
| 794 | [0x6d] = { .c = 0x29, .l = 10 }, |
| 795 | [0x6e] = { .c = 0x29, .l = 10 }, |
| 796 | [0x6f] = { .c = 0x29, .l = 10 }, |
| 797 | [0x70] = { .c = 0x29, .l = 10 }, |
| 798 | [0x71] = { .c = 0x29, .l = 10 }, |
| 799 | [0x72] = { .c = 0x29, .l = 10 }, |
| 800 | [0x73] = { .c = 0x29, .l = 10 }, |
| 801 | [0x74] = { .c = 0x29, .l = 10 }, |
| 802 | [0x75] = { .c = 0x29, .l = 10 }, |
| 803 | [0x76] = { .c = 0x29, .l = 10 }, |
| 804 | [0x77] = { .c = 0x29, .l = 10 }, |
| 805 | [0x78] = { .c = 0x29, .l = 10 }, |
| 806 | [0x79] = { .c = 0x29, .l = 10 }, |
| 807 | [0x7a] = { .c = 0x29, .l = 10 }, |
| 808 | [0x7b] = { .c = 0x29, .l = 10 }, |
| 809 | [0x7c] = { .c = 0x29, .l = 10 }, |
| 810 | [0x7d] = { .c = 0x29, .l = 10 }, |
| 811 | [0x7e] = { .c = 0x29, .l = 10 }, |
| 812 | [0x7f] = { .c = 0x29, .l = 10 }, |
| 813 | [0x80] = { .c = 0x3f, .l = 10 }, |
| 814 | [0x81] = { .c = 0x3f, .l = 10 }, |
| 815 | [0x82] = { .c = 0x3f, .l = 10 }, |
| 816 | [0x83] = { .c = 0x3f, .l = 10 }, |
| 817 | [0x84] = { .c = 0x3f, .l = 10 }, |
| 818 | [0x85] = { .c = 0x3f, .l = 10 }, |
| 819 | [0x86] = { .c = 0x3f, .l = 10 }, |
| 820 | [0x87] = { .c = 0x3f, .l = 10 }, |
| 821 | [0x88] = { .c = 0x3f, .l = 10 }, |
| 822 | [0x89] = { .c = 0x3f, .l = 10 }, |
| 823 | [0x8a] = { .c = 0x3f, .l = 10 }, |
| 824 | [0x8b] = { .c = 0x3f, .l = 10 }, |
| 825 | [0x8c] = { .c = 0x3f, .l = 10 }, |
| 826 | [0x8d] = { .c = 0x3f, .l = 10 }, |
| 827 | [0x8e] = { .c = 0x3f, .l = 10 }, |
| 828 | [0x8f] = { .c = 0x3f, .l = 10 }, |
| 829 | [0x90] = { .c = 0x3f, .l = 10 }, |
| 830 | [0x91] = { .c = 0x3f, .l = 10 }, |
| 831 | [0x92] = { .c = 0x3f, .l = 10 }, |
| 832 | [0x93] = { .c = 0x3f, .l = 10 }, |
| 833 | [0x94] = { .c = 0x3f, .l = 10 }, |
| 834 | [0x95] = { .c = 0x3f, .l = 10 }, |
| 835 | [0x96] = { .c = 0x3f, .l = 10 }, |
| 836 | [0x97] = { .c = 0x3f, .l = 10 }, |
| 837 | [0x98] = { .c = 0x3f, .l = 10 }, |
| 838 | [0x99] = { .c = 0x3f, .l = 10 }, |
| 839 | [0x9a] = { .c = 0x3f, .l = 10 }, |
| 840 | [0x9b] = { .c = 0x3f, .l = 10 }, |
| 841 | [0x9c] = { .c = 0x3f, .l = 10 }, |
| 842 | [0x9d] = { .c = 0x3f, .l = 10 }, |
| 843 | [0x9e] = { .c = 0x3f, .l = 10 }, |
| 844 | [0x9f] = { .c = 0x3f, .l = 10 }, |
| 845 | [0xa0] = { .c = 0x27, .l = 11 }, |
| 846 | [0xa1] = { .c = 0x27, .l = 11 }, |
| 847 | [0xa2] = { .c = 0x27, .l = 11 }, |
| 848 | [0xa3] = { .c = 0x27, .l = 11 }, |
| 849 | [0xa4] = { .c = 0x27, .l = 11 }, |
| 850 | [0xa5] = { .c = 0x27, .l = 11 }, |
| 851 | [0xa6] = { .c = 0x27, .l = 11 }, |
| 852 | [0xa7] = { .c = 0x27, .l = 11 }, |
| 853 | [0xa8] = { .c = 0x27, .l = 11 }, |
| 854 | [0xa9] = { .c = 0x27, .l = 11 }, |
| 855 | [0xaa] = { .c = 0x27, .l = 11 }, |
| 856 | [0xab] = { .c = 0x27, .l = 11 }, |
| 857 | [0xac] = { .c = 0x27, .l = 11 }, |
| 858 | [0xad] = { .c = 0x27, .l = 11 }, |
| 859 | [0xae] = { .c = 0x27, .l = 11 }, |
| 860 | [0xaf] = { .c = 0x27, .l = 11 }, |
| 861 | [0xb0] = { .c = 0x2b, .l = 11 }, |
| 862 | [0xb1] = { .c = 0x2b, .l = 11 }, |
| 863 | [0xb2] = { .c = 0x2b, .l = 11 }, |
| 864 | [0xb3] = { .c = 0x2b, .l = 11 }, |
| 865 | [0xb4] = { .c = 0x2b, .l = 11 }, |
| 866 | [0xb5] = { .c = 0x2b, .l = 11 }, |
| 867 | [0xb6] = { .c = 0x2b, .l = 11 }, |
| 868 | [0xb7] = { .c = 0x2b, .l = 11 }, |
| 869 | [0xb8] = { .c = 0x2b, .l = 11 }, |
| 870 | [0xb9] = { .c = 0x2b, .l = 11 }, |
| 871 | [0xba] = { .c = 0x2b, .l = 11 }, |
| 872 | [0xbb] = { .c = 0x2b, .l = 11 }, |
| 873 | [0xbc] = { .c = 0x2b, .l = 11 }, |
| 874 | [0xbd] = { .c = 0x2b, .l = 11 }, |
| 875 | [0xbe] = { .c = 0x2b, .l = 11 }, |
| 876 | [0xbf] = { .c = 0x2b, .l = 11 }, |
| 877 | [0xc0] = { .c = 0x7c, .l = 11 }, |
| 878 | [0xc1] = { .c = 0x7c, .l = 11 }, |
| 879 | [0xc2] = { .c = 0x7c, .l = 11 }, |
| 880 | [0xc3] = { .c = 0x7c, .l = 11 }, |
| 881 | [0xc4] = { .c = 0x7c, .l = 11 }, |
| 882 | [0xc5] = { .c = 0x7c, .l = 11 }, |
| 883 | [0xc6] = { .c = 0x7c, .l = 11 }, |
| 884 | [0xc7] = { .c = 0x7c, .l = 11 }, |
| 885 | [0xc8] = { .c = 0x7c, .l = 11 }, |
| 886 | [0xc9] = { .c = 0x7c, .l = 11 }, |
| 887 | [0xca] = { .c = 0x7c, .l = 11 }, |
| 888 | [0xcb] = { .c = 0x7c, .l = 11 }, |
| 889 | [0xcc] = { .c = 0x7c, .l = 11 }, |
| 890 | [0xcd] = { .c = 0x7c, .l = 11 }, |
| 891 | [0xce] = { .c = 0x7c, .l = 11 }, |
| 892 | [0xcf] = { .c = 0x7c, .l = 11 }, |
| 893 | [0xd0] = { .c = 0x23, .l = 12 }, |
| 894 | [0xd1] = { .c = 0x23, .l = 12 }, |
| 895 | [0xd2] = { .c = 0x23, .l = 12 }, |
| 896 | [0xd3] = { .c = 0x23, .l = 12 }, |
| 897 | [0xd4] = { .c = 0x23, .l = 12 }, |
| 898 | [0xd5] = { .c = 0x23, .l = 12 }, |
| 899 | [0xd6] = { .c = 0x23, .l = 12 }, |
| 900 | [0xd7] = { .c = 0x23, .l = 12 }, |
| 901 | [0xd8] = { .c = 0x3e, .l = 12 }, |
| 902 | [0xd9] = { .c = 0x3e, .l = 12 }, |
| 903 | [0xda] = { .c = 0x3e, .l = 12 }, |
| 904 | [0xdb] = { .c = 0x3e, .l = 12 }, |
| 905 | [0xdc] = { .c = 0x3e, .l = 12 }, |
| 906 | [0xdd] = { .c = 0x3e, .l = 12 }, |
| 907 | [0xde] = { .c = 0x3e, .l = 12 }, |
| 908 | [0xdf] = { .c = 0x3e, .l = 12 }, |
| 909 | [0xe0] = { .c = 0x00, .l = 13 }, |
| 910 | [0xe1] = { .c = 0x00, .l = 13 }, |
| 911 | [0xe2] = { .c = 0x00, .l = 13 }, |
| 912 | [0xe3] = { .c = 0x00, .l = 13 }, |
| 913 | [0xe4] = { .c = 0x24, .l = 13 }, |
| 914 | [0xe5] = { .c = 0x24, .l = 13 }, |
| 915 | [0xe6] = { .c = 0x24, .l = 13 }, |
| 916 | [0xe7] = { .c = 0x24, .l = 13 }, |
| 917 | [0xe8] = { .c = 0x40, .l = 13 }, |
| 918 | [0xe9] = { .c = 0x40, .l = 13 }, |
| 919 | [0xea] = { .c = 0x40, .l = 13 }, |
| 920 | [0xeb] = { .c = 0x40, .l = 13 }, |
| 921 | [0xec] = { .c = 0x5b, .l = 13 }, |
| 922 | [0xed] = { .c = 0x5b, .l = 13 }, |
| 923 | [0xee] = { .c = 0x5b, .l = 13 }, |
| 924 | [0xef] = { .c = 0x5b, .l = 13 }, |
| 925 | [0xf0] = { .c = 0x5d, .l = 13 }, |
| 926 | [0xf1] = { .c = 0x5d, .l = 13 }, |
| 927 | [0xf2] = { .c = 0x5d, .l = 13 }, |
| 928 | [0xf3] = { .c = 0x5d, .l = 13 }, |
| 929 | [0xf4] = { .c = 0x7e, .l = 13 }, |
| 930 | [0xf5] = { .c = 0x7e, .l = 13 }, |
| 931 | [0xf6] = { .c = 0x7e, .l = 13 }, |
| 932 | [0xf7] = { .c = 0x7e, .l = 13 }, |
| 933 | [0xf8] = { .c = 0x5e, .l = 14 }, |
| 934 | [0xf9] = { .c = 0x5e, .l = 14 }, |
| 935 | [0xfa] = { .c = 0x7d, .l = 14 }, |
| 936 | [0xfb] = { .c = 0x7d, .l = 14 }, |
| 937 | [0xfc] = { .c = 0x3c, .l = 15 }, |
| 938 | [0xfd] = { .c = 0x60, .l = 15 }, |
| 939 | [0xfe] = { .c = 0x7b, .l = 15 }, |
| 940 | }; |
| 941 | |
| 942 | struct rht rht_bit15_11_fe[32] = { |
| 943 | [0x00] = { .c = 0x5c, .l = 19 }, |
| 944 | [0x01] = { .c = 0x5c, .l = 19 }, |
| 945 | [0x02] = { .c = 0x5c, .l = 19 }, |
| 946 | [0x03] = { .c = 0x5c, .l = 19 }, |
| 947 | [0x04] = { .c = 0xc3, .l = 19 }, |
| 948 | [0x05] = { .c = 0xc3, .l = 19 }, |
| 949 | [0x06] = { .c = 0xc3, .l = 19 }, |
| 950 | [0x07] = { .c = 0xc3, .l = 19 }, |
| 951 | [0x08] = { .c = 0xd0, .l = 19 }, |
| 952 | [0x09] = { .c = 0xd0, .l = 19 }, |
| 953 | [0x0a] = { .c = 0xd0, .l = 19 }, |
| 954 | [0x0b] = { .c = 0xd0, .l = 19 }, |
| 955 | [0x0c] = { .c = 0x80, .l = 20 }, |
| 956 | [0x0d] = { .c = 0x80, .l = 20 }, |
| 957 | [0x0e] = { .c = 0x82, .l = 20 }, |
| 958 | [0x0f] = { .c = 0x82, .l = 20 }, |
| 959 | [0x10] = { .c = 0x83, .l = 20 }, |
| 960 | [0x11] = { .c = 0x83, .l = 20 }, |
| 961 | [0x12] = { .c = 0xa2, .l = 20 }, |
| 962 | [0x13] = { .c = 0xa2, .l = 20 }, |
| 963 | [0x14] = { .c = 0xb8, .l = 20 }, |
| 964 | [0x15] = { .c = 0xb8, .l = 20 }, |
| 965 | [0x16] = { .c = 0xc2, .l = 20 }, |
| 966 | [0x17] = { .c = 0xc2, .l = 20 }, |
| 967 | [0x18] = { .c = 0xe0, .l = 20 }, |
| 968 | [0x19] = { .c = 0xe0, .l = 20 }, |
| 969 | [0x1a] = { .c = 0xe2, .l = 20 }, |
| 970 | [0x1b] = { .c = 0xe2, .l = 20 }, |
| 971 | [0x1c] = { .c = 0x99, .l = 21 }, |
| 972 | [0x1d] = { .c = 0xa1, .l = 21 }, |
| 973 | [0x1e] = { .c = 0xa7, .l = 21 }, |
| 974 | [0x1f] = { .c = 0xac, .l = 21 }, |
| 975 | }; |
| 976 | |
| 977 | struct rht rht_bit15_8[256] = { |
| 978 | [0x00] = { .c = 0xb0, .l = 21 }, |
| 979 | [0x01] = { .c = 0xb0, .l = 21 }, |
| 980 | [0x02] = { .c = 0xb0, .l = 21 }, |
| 981 | [0x03] = { .c = 0xb0, .l = 21 }, |
| 982 | [0x04] = { .c = 0xb0, .l = 21 }, |
| 983 | [0x05] = { .c = 0xb0, .l = 21 }, |
| 984 | [0x06] = { .c = 0xb0, .l = 21 }, |
| 985 | [0x07] = { .c = 0xb0, .l = 21 }, |
| 986 | [0x08] = { .c = 0xb1, .l = 21 }, |
| 987 | [0x09] = { .c = 0xb1, .l = 21 }, |
| 988 | [0x0a] = { .c = 0xb1, .l = 21 }, |
| 989 | [0x0b] = { .c = 0xb1, .l = 21 }, |
| 990 | [0x0c] = { .c = 0xb1, .l = 21 }, |
| 991 | [0x0d] = { .c = 0xb1, .l = 21 }, |
| 992 | [0x0e] = { .c = 0xb1, .l = 21 }, |
| 993 | [0x0f] = { .c = 0xb1, .l = 21 }, |
| 994 | [0x10] = { .c = 0xb3, .l = 21 }, |
| 995 | [0x11] = { .c = 0xb3, .l = 21 }, |
| 996 | [0x12] = { .c = 0xb3, .l = 21 }, |
| 997 | [0x13] = { .c = 0xb3, .l = 21 }, |
| 998 | [0x14] = { .c = 0xb3, .l = 21 }, |
| 999 | [0x15] = { .c = 0xb3, .l = 21 }, |
| 1000 | [0x16] = { .c = 0xb3, .l = 21 }, |
| 1001 | [0x17] = { .c = 0xb3, .l = 21 }, |
| 1002 | [0x18] = { .c = 0xd1, .l = 21 }, |
| 1003 | [0x19] = { .c = 0xd1, .l = 21 }, |
| 1004 | [0x1a] = { .c = 0xd1, .l = 21 }, |
| 1005 | [0x1b] = { .c = 0xd1, .l = 21 }, |
| 1006 | [0x1c] = { .c = 0xd1, .l = 21 }, |
| 1007 | [0x1d] = { .c = 0xd1, .l = 21 }, |
| 1008 | [0x1e] = { .c = 0xd1, .l = 21 }, |
| 1009 | [0x1f] = { .c = 0xd1, .l = 21 }, |
| 1010 | [0x20] = { .c = 0xd8, .l = 21 }, |
| 1011 | [0x21] = { .c = 0xd8, .l = 21 }, |
| 1012 | [0x22] = { .c = 0xd8, .l = 21 }, |
| 1013 | [0x23] = { .c = 0xd8, .l = 21 }, |
| 1014 | [0x24] = { .c = 0xd8, .l = 21 }, |
| 1015 | [0x25] = { .c = 0xd8, .l = 21 }, |
| 1016 | [0x26] = { .c = 0xd8, .l = 21 }, |
| 1017 | [0x27] = { .c = 0xd8, .l = 21 }, |
| 1018 | [0x28] = { .c = 0xd9, .l = 21 }, |
| 1019 | [0x29] = { .c = 0xd9, .l = 21 }, |
| 1020 | [0x2a] = { .c = 0xd9, .l = 21 }, |
| 1021 | [0x2b] = { .c = 0xd9, .l = 21 }, |
| 1022 | [0x2c] = { .c = 0xd9, .l = 21 }, |
| 1023 | [0x2d] = { .c = 0xd9, .l = 21 }, |
| 1024 | [0x2e] = { .c = 0xd9, .l = 21 }, |
| 1025 | [0x2f] = { .c = 0xd9, .l = 21 }, |
| 1026 | [0x30] = { .c = 0xe3, .l = 21 }, |
| 1027 | [0x31] = { .c = 0xe3, .l = 21 }, |
| 1028 | [0x32] = { .c = 0xe3, .l = 21 }, |
| 1029 | [0x33] = { .c = 0xe3, .l = 21 }, |
| 1030 | [0x34] = { .c = 0xe3, .l = 21 }, |
| 1031 | [0x35] = { .c = 0xe3, .l = 21 }, |
| 1032 | [0x36] = { .c = 0xe3, .l = 21 }, |
| 1033 | [0x37] = { .c = 0xe3, .l = 21 }, |
| 1034 | [0x38] = { .c = 0xe5, .l = 21 }, |
| 1035 | [0x39] = { .c = 0xe5, .l = 21 }, |
| 1036 | [0x3a] = { .c = 0xe5, .l = 21 }, |
| 1037 | [0x3b] = { .c = 0xe5, .l = 21 }, |
| 1038 | [0x3c] = { .c = 0xe5, .l = 21 }, |
| 1039 | [0x3d] = { .c = 0xe5, .l = 21 }, |
| 1040 | [0x3e] = { .c = 0xe5, .l = 21 }, |
| 1041 | [0x3f] = { .c = 0xe5, .l = 21 }, |
| 1042 | [0x40] = { .c = 0xe6, .l = 21 }, |
| 1043 | [0x41] = { .c = 0xe6, .l = 21 }, |
| 1044 | [0x42] = { .c = 0xe6, .l = 21 }, |
| 1045 | [0x43] = { .c = 0xe6, .l = 21 }, |
| 1046 | [0x44] = { .c = 0xe6, .l = 21 }, |
| 1047 | [0x45] = { .c = 0xe6, .l = 21 }, |
| 1048 | [0x46] = { .c = 0xe6, .l = 21 }, |
| 1049 | [0x47] = { .c = 0xe6, .l = 21 }, |
| 1050 | [0x48] = { .c = 0x81, .l = 22 }, |
| 1051 | [0x49] = { .c = 0x81, .l = 22 }, |
| 1052 | [0x4a] = { .c = 0x81, .l = 22 }, |
| 1053 | [0x4b] = { .c = 0x81, .l = 22 }, |
| 1054 | [0x4c] = { .c = 0x84, .l = 22 }, |
| 1055 | [0x4d] = { .c = 0x84, .l = 22 }, |
| 1056 | [0x4e] = { .c = 0x84, .l = 22 }, |
| 1057 | [0x4f] = { .c = 0x84, .l = 22 }, |
| 1058 | [0x50] = { .c = 0x85, .l = 22 }, |
| 1059 | [0x51] = { .c = 0x85, .l = 22 }, |
| 1060 | [0x52] = { .c = 0x85, .l = 22 }, |
| 1061 | [0x53] = { .c = 0x85, .l = 22 }, |
| 1062 | [0x54] = { .c = 0x86, .l = 22 }, |
| 1063 | [0x55] = { .c = 0x86, .l = 22 }, |
| 1064 | [0x56] = { .c = 0x86, .l = 22 }, |
| 1065 | [0x57] = { .c = 0x86, .l = 22 }, |
| 1066 | [0x58] = { .c = 0x88, .l = 22 }, |
| 1067 | [0x59] = { .c = 0x88, .l = 22 }, |
| 1068 | [0x5a] = { .c = 0x88, .l = 22 }, |
| 1069 | [0x5b] = { .c = 0x88, .l = 22 }, |
| 1070 | [0x5c] = { .c = 0x92, .l = 22 }, |
| 1071 | [0x5d] = { .c = 0x92, .l = 22 }, |
| 1072 | [0x5e] = { .c = 0x92, .l = 22 }, |
| 1073 | [0x5f] = { .c = 0x92, .l = 22 }, |
| 1074 | [0x60] = { .c = 0x9a, .l = 22 }, |
| 1075 | [0x61] = { .c = 0x9a, .l = 22 }, |
| 1076 | [0x62] = { .c = 0x9a, .l = 22 }, |
| 1077 | [0x63] = { .c = 0x9a, .l = 22 }, |
| 1078 | [0x64] = { .c = 0x9c, .l = 22 }, |
| 1079 | [0x65] = { .c = 0x9c, .l = 22 }, |
| 1080 | [0x66] = { .c = 0x9c, .l = 22 }, |
| 1081 | [0x67] = { .c = 0x9c, .l = 22 }, |
| 1082 | [0x68] = { .c = 0xa0, .l = 22 }, |
| 1083 | [0x69] = { .c = 0xa0, .l = 22 }, |
| 1084 | [0x6a] = { .c = 0xa0, .l = 22 }, |
| 1085 | [0x6b] = { .c = 0xa0, .l = 22 }, |
| 1086 | [0x6c] = { .c = 0xa3, .l = 22 }, |
| 1087 | [0x6d] = { .c = 0xa3, .l = 22 }, |
| 1088 | [0x6e] = { .c = 0xa3, .l = 22 }, |
| 1089 | [0x6f] = { .c = 0xa3, .l = 22 }, |
| 1090 | [0x70] = { .c = 0xa4, .l = 22 }, |
| 1091 | [0x71] = { .c = 0xa4, .l = 22 }, |
| 1092 | [0x72] = { .c = 0xa4, .l = 22 }, |
| 1093 | [0x73] = { .c = 0xa4, .l = 22 }, |
| 1094 | [0x74] = { .c = 0xa9, .l = 22 }, |
| 1095 | [0x75] = { .c = 0xa9, .l = 22 }, |
| 1096 | [0x76] = { .c = 0xa9, .l = 22 }, |
| 1097 | [0x77] = { .c = 0xa9, .l = 22 }, |
| 1098 | [0x78] = { .c = 0xaa, .l = 22 }, |
| 1099 | [0x79] = { .c = 0xaa, .l = 22 }, |
| 1100 | [0x7a] = { .c = 0xaa, .l = 22 }, |
| 1101 | [0x7b] = { .c = 0xaa, .l = 22 }, |
| 1102 | [0x7c] = { .c = 0xad, .l = 22 }, |
| 1103 | [0x7d] = { .c = 0xad, .l = 22 }, |
| 1104 | [0x7e] = { .c = 0xad, .l = 22 }, |
| 1105 | [0x7f] = { .c = 0xad, .l = 22 }, |
| 1106 | [0x80] = { .c = 0xb2, .l = 22 }, |
| 1107 | [0x81] = { .c = 0xb2, .l = 22 }, |
| 1108 | [0x82] = { .c = 0xb2, .l = 22 }, |
| 1109 | [0x83] = { .c = 0xb2, .l = 22 }, |
| 1110 | [0x84] = { .c = 0xb5, .l = 22 }, |
| 1111 | [0x85] = { .c = 0xb5, .l = 22 }, |
| 1112 | [0x86] = { .c = 0xb5, .l = 22 }, |
| 1113 | [0x87] = { .c = 0xb5, .l = 22 }, |
| 1114 | [0x88] = { .c = 0xb9, .l = 22 }, |
| 1115 | [0x89] = { .c = 0xb9, .l = 22 }, |
| 1116 | [0x8a] = { .c = 0xb9, .l = 22 }, |
| 1117 | [0x8b] = { .c = 0xb9, .l = 22 }, |
| 1118 | [0x8c] = { .c = 0xba, .l = 22 }, |
| 1119 | [0x8d] = { .c = 0xba, .l = 22 }, |
| 1120 | [0x8e] = { .c = 0xba, .l = 22 }, |
| 1121 | [0x8f] = { .c = 0xba, .l = 22 }, |
| 1122 | [0x90] = { .c = 0xbb, .l = 22 }, |
| 1123 | [0x91] = { .c = 0xbb, .l = 22 }, |
| 1124 | [0x92] = { .c = 0xbb, .l = 22 }, |
| 1125 | [0x93] = { .c = 0xbb, .l = 22 }, |
| 1126 | [0x94] = { .c = 0xbd, .l = 22 }, |
| 1127 | [0x95] = { .c = 0xbd, .l = 22 }, |
| 1128 | [0x96] = { .c = 0xbd, .l = 22 }, |
| 1129 | [0x97] = { .c = 0xbd, .l = 22 }, |
| 1130 | [0x98] = { .c = 0xbe, .l = 22 }, |
| 1131 | [0x99] = { .c = 0xbe, .l = 22 }, |
| 1132 | [0x9a] = { .c = 0xbe, .l = 22 }, |
| 1133 | [0x9b] = { .c = 0xbe, .l = 22 }, |
| 1134 | [0x9c] = { .c = 0xc4, .l = 22 }, |
| 1135 | [0x9d] = { .c = 0xc4, .l = 22 }, |
| 1136 | [0x9e] = { .c = 0xc4, .l = 22 }, |
| 1137 | [0x9f] = { .c = 0xc4, .l = 22 }, |
| 1138 | [0xa0] = { .c = 0xc6, .l = 22 }, |
| 1139 | [0xa1] = { .c = 0xc6, .l = 22 }, |
| 1140 | [0xa2] = { .c = 0xc6, .l = 22 }, |
| 1141 | [0xa3] = { .c = 0xc6, .l = 22 }, |
| 1142 | [0xa4] = { .c = 0xe4, .l = 22 }, |
| 1143 | [0xa5] = { .c = 0xe4, .l = 22 }, |
| 1144 | [0xa6] = { .c = 0xe4, .l = 22 }, |
| 1145 | [0xa7] = { .c = 0xe4, .l = 22 }, |
| 1146 | [0xa8] = { .c = 0xe8, .l = 22 }, |
| 1147 | [0xa9] = { .c = 0xe8, .l = 22 }, |
| 1148 | [0xaa] = { .c = 0xe8, .l = 22 }, |
| 1149 | [0xab] = { .c = 0xe8, .l = 22 }, |
| 1150 | [0xac] = { .c = 0xe9, .l = 22 }, |
| 1151 | [0xad] = { .c = 0xe9, .l = 22 }, |
| 1152 | [0xae] = { .c = 0xe9, .l = 22 }, |
| 1153 | [0xaf] = { .c = 0xe9, .l = 22 }, |
| 1154 | [0xb0] = { .c = 0x01, .l = 23 }, |
| 1155 | [0xb1] = { .c = 0x01, .l = 23 }, |
| 1156 | [0xb2] = { .c = 0x87, .l = 23 }, |
| 1157 | [0xb3] = { .c = 0x87, .l = 23 }, |
| 1158 | [0xb4] = { .c = 0x89, .l = 23 }, |
| 1159 | [0xb5] = { .c = 0x89, .l = 23 }, |
| 1160 | [0xb6] = { .c = 0x8a, .l = 23 }, |
| 1161 | [0xb7] = { .c = 0x8a, .l = 23 }, |
| 1162 | [0xb8] = { .c = 0x8b, .l = 23 }, |
| 1163 | [0xb9] = { .c = 0x8b, .l = 23 }, |
| 1164 | [0xba] = { .c = 0x8c, .l = 23 }, |
| 1165 | [0xbb] = { .c = 0x8c, .l = 23 }, |
| 1166 | [0xbc] = { .c = 0x8d, .l = 23 }, |
| 1167 | [0xbd] = { .c = 0x8d, .l = 23 }, |
| 1168 | [0xbe] = { .c = 0x8f, .l = 23 }, |
| 1169 | [0xbf] = { .c = 0x8f, .l = 23 }, |
| 1170 | [0xc0] = { .c = 0x93, .l = 23 }, |
| 1171 | [0xc1] = { .c = 0x93, .l = 23 }, |
| 1172 | [0xc2] = { .c = 0x95, .l = 23 }, |
| 1173 | [0xc3] = { .c = 0x95, .l = 23 }, |
| 1174 | [0xc4] = { .c = 0x96, .l = 23 }, |
| 1175 | [0xc5] = { .c = 0x96, .l = 23 }, |
| 1176 | [0xc6] = { .c = 0x97, .l = 23 }, |
| 1177 | [0xc7] = { .c = 0x97, .l = 23 }, |
| 1178 | [0xc8] = { .c = 0x98, .l = 23 }, |
| 1179 | [0xc9] = { .c = 0x98, .l = 23 }, |
| 1180 | [0xca] = { .c = 0x9b, .l = 23 }, |
| 1181 | [0xcb] = { .c = 0x9b, .l = 23 }, |
| 1182 | [0xcc] = { .c = 0x9d, .l = 23 }, |
| 1183 | [0xcd] = { .c = 0x9d, .l = 23 }, |
| 1184 | [0xce] = { .c = 0x9e, .l = 23 }, |
| 1185 | [0xcf] = { .c = 0x9e, .l = 23 }, |
| 1186 | [0xd0] = { .c = 0xa5, .l = 23 }, |
| 1187 | [0xd1] = { .c = 0xa5, .l = 23 }, |
| 1188 | [0xd2] = { .c = 0xa6, .l = 23 }, |
| 1189 | [0xd3] = { .c = 0xa6, .l = 23 }, |
| 1190 | [0xd4] = { .c = 0xa8, .l = 23 }, |
| 1191 | [0xd5] = { .c = 0xa8, .l = 23 }, |
| 1192 | [0xd6] = { .c = 0xae, .l = 23 }, |
| 1193 | [0xd7] = { .c = 0xae, .l = 23 }, |
| 1194 | [0xd8] = { .c = 0xaf, .l = 23 }, |
| 1195 | [0xd9] = { .c = 0xaf, .l = 23 }, |
| 1196 | [0xda] = { .c = 0xb4, .l = 23 }, |
| 1197 | [0xdb] = { .c = 0xb4, .l = 23 }, |
| 1198 | [0xdc] = { .c = 0xb6, .l = 23 }, |
| 1199 | [0xdd] = { .c = 0xb6, .l = 23 }, |
| 1200 | [0xde] = { .c = 0xb7, .l = 23 }, |
| 1201 | [0xdf] = { .c = 0xb7, .l = 23 }, |
| 1202 | [0xe0] = { .c = 0xbc, .l = 23 }, |
| 1203 | [0xe1] = { .c = 0xbc, .l = 23 }, |
| 1204 | [0xe2] = { .c = 0xbf, .l = 23 }, |
| 1205 | [0xe3] = { .c = 0xbf, .l = 23 }, |
| 1206 | [0xe4] = { .c = 0xc5, .l = 23 }, |
| 1207 | [0xe5] = { .c = 0xc5, .l = 23 }, |
| 1208 | [0xe6] = { .c = 0xe7, .l = 23 }, |
| 1209 | [0xe7] = { .c = 0xe7, .l = 23 }, |
| 1210 | [0xe8] = { .c = 0xef, .l = 23 }, |
| 1211 | [0xe9] = { .c = 0xef, .l = 23 }, |
| 1212 | [0xea] = { .c = 0x09, .l = 24 }, |
| 1213 | [0xeb] = { .c = 0x8e, .l = 24 }, |
| 1214 | [0xec] = { .c = 0x90, .l = 24 }, |
| 1215 | [0xed] = { .c = 0x91, .l = 24 }, |
| 1216 | [0xee] = { .c = 0x94, .l = 24 }, |
| 1217 | [0xef] = { .c = 0x9f, .l = 24 }, |
| 1218 | [0xf0] = { .c = 0xab, .l = 24 }, |
| 1219 | [0xf1] = { .c = 0xce, .l = 24 }, |
| 1220 | [0xf2] = { .c = 0xd7, .l = 24 }, |
| 1221 | [0xf3] = { .c = 0xe1, .l = 24 }, |
| 1222 | [0xf4] = { .c = 0xec, .l = 24 }, |
| 1223 | [0xf5] = { .c = 0xed, .l = 24 }, |
| 1224 | }; |
| 1225 | |
| 1226 | struct rht rht_bit11_4[256] = { |
| 1227 | [0x60] = { .c = 0xc7, .l = 25 }, |
| 1228 | [0x61] = { .c = 0xc7, .l = 25 }, |
| 1229 | [0x62] = { .c = 0xc7, .l = 25 }, |
| 1230 | [0x63] = { .c = 0xc7, .l = 25 }, |
| 1231 | [0x64] = { .c = 0xc7, .l = 25 }, |
| 1232 | [0x65] = { .c = 0xc7, .l = 25 }, |
| 1233 | [0x66] = { .c = 0xc7, .l = 25 }, |
| 1234 | [0x67] = { .c = 0xc7, .l = 25 }, |
| 1235 | [0x68] = { .c = 0xcf, .l = 25 }, |
| 1236 | [0x69] = { .c = 0xcf, .l = 25 }, |
| 1237 | [0x6a] = { .c = 0xcf, .l = 25 }, |
| 1238 | [0x6b] = { .c = 0xcf, .l = 25 }, |
| 1239 | [0x6c] = { .c = 0xcf, .l = 25 }, |
| 1240 | [0x6d] = { .c = 0xcf, .l = 25 }, |
| 1241 | [0x6e] = { .c = 0xcf, .l = 25 }, |
| 1242 | [0x6f] = { .c = 0xcf, .l = 25 }, |
| 1243 | [0x70] = { .c = 0xea, .l = 25 }, |
| 1244 | [0x71] = { .c = 0xea, .l = 25 }, |
| 1245 | [0x72] = { .c = 0xea, .l = 25 }, |
| 1246 | [0x73] = { .c = 0xea, .l = 25 }, |
| 1247 | [0x74] = { .c = 0xea, .l = 25 }, |
| 1248 | [0x75] = { .c = 0xea, .l = 25 }, |
| 1249 | [0x76] = { .c = 0xea, .l = 25 }, |
| 1250 | [0x77] = { .c = 0xea, .l = 25 }, |
| 1251 | [0x78] = { .c = 0xeb, .l = 25 }, |
| 1252 | [0x79] = { .c = 0xeb, .l = 25 }, |
| 1253 | [0x7a] = { .c = 0xeb, .l = 25 }, |
| 1254 | [0x7b] = { .c = 0xeb, .l = 25 }, |
| 1255 | [0x7c] = { .c = 0xeb, .l = 25 }, |
| 1256 | [0x7d] = { .c = 0xeb, .l = 25 }, |
| 1257 | [0x7e] = { .c = 0xeb, .l = 25 }, |
| 1258 | [0x7f] = { .c = 0xeb, .l = 25 }, |
| 1259 | [0x80] = { .c = 0xc0, .l = 26 }, |
| 1260 | [0x81] = { .c = 0xc0, .l = 26 }, |
| 1261 | [0x82] = { .c = 0xc0, .l = 26 }, |
| 1262 | [0x83] = { .c = 0xc0, .l = 26 }, |
| 1263 | [0x84] = { .c = 0xc1, .l = 26 }, |
| 1264 | [0x85] = { .c = 0xc1, .l = 26 }, |
| 1265 | [0x86] = { .c = 0xc1, .l = 26 }, |
| 1266 | [0x87] = { .c = 0xc1, .l = 26 }, |
| 1267 | [0x88] = { .c = 0xc8, .l = 26 }, |
| 1268 | [0x89] = { .c = 0xc8, .l = 26 }, |
| 1269 | [0x8a] = { .c = 0xc8, .l = 26 }, |
| 1270 | [0x8b] = { .c = 0xc8, .l = 26 }, |
| 1271 | [0x8c] = { .c = 0xc9, .l = 26 }, |
| 1272 | [0x8d] = { .c = 0xc9, .l = 26 }, |
| 1273 | [0x8e] = { .c = 0xc9, .l = 26 }, |
| 1274 | [0x8f] = { .c = 0xc9, .l = 26 }, |
| 1275 | [0x90] = { .c = 0xca, .l = 26 }, |
| 1276 | [0x91] = { .c = 0xca, .l = 26 }, |
| 1277 | [0x92] = { .c = 0xca, .l = 26 }, |
| 1278 | [0x93] = { .c = 0xca, .l = 26 }, |
| 1279 | [0x94] = { .c = 0xcd, .l = 26 }, |
| 1280 | [0x95] = { .c = 0xcd, .l = 26 }, |
| 1281 | [0x96] = { .c = 0xcd, .l = 26 }, |
| 1282 | [0x97] = { .c = 0xcd, .l = 26 }, |
| 1283 | [0x98] = { .c = 0xd2, .l = 26 }, |
| 1284 | [0x99] = { .c = 0xd2, .l = 26 }, |
| 1285 | [0x9a] = { .c = 0xd2, .l = 26 }, |
| 1286 | [0x9b] = { .c = 0xd2, .l = 26 }, |
| 1287 | [0x9c] = { .c = 0xd5, .l = 26 }, |
| 1288 | [0x9d] = { .c = 0xd5, .l = 26 }, |
| 1289 | [0x9e] = { .c = 0xd5, .l = 26 }, |
| 1290 | [0x9f] = { .c = 0xd5, .l = 26 }, |
| 1291 | [0xa0] = { .c = 0xda, .l = 26 }, |
| 1292 | [0xa1] = { .c = 0xda, .l = 26 }, |
| 1293 | [0xa2] = { .c = 0xda, .l = 26 }, |
| 1294 | [0xa3] = { .c = 0xda, .l = 26 }, |
| 1295 | [0xa4] = { .c = 0xdb, .l = 26 }, |
| 1296 | [0xa5] = { .c = 0xdb, .l = 26 }, |
| 1297 | [0xa6] = { .c = 0xdb, .l = 26 }, |
| 1298 | [0xa7] = { .c = 0xdb, .l = 26 }, |
| 1299 | [0xa8] = { .c = 0xee, .l = 26 }, |
| 1300 | [0xa9] = { .c = 0xee, .l = 26 }, |
| 1301 | [0xaa] = { .c = 0xee, .l = 26 }, |
| 1302 | [0xab] = { .c = 0xee, .l = 26 }, |
| 1303 | [0xac] = { .c = 0xf0, .l = 26 }, |
| 1304 | [0xad] = { .c = 0xf0, .l = 26 }, |
| 1305 | [0xae] = { .c = 0xf0, .l = 26 }, |
| 1306 | [0xaf] = { .c = 0xf0, .l = 26 }, |
| 1307 | [0xb0] = { .c = 0xf2, .l = 26 }, |
| 1308 | [0xb1] = { .c = 0xf2, .l = 26 }, |
| 1309 | [0xb2] = { .c = 0xf2, .l = 26 }, |
| 1310 | [0xb3] = { .c = 0xf2, .l = 26 }, |
| 1311 | [0xb4] = { .c = 0xf3, .l = 26 }, |
| 1312 | [0xb5] = { .c = 0xf3, .l = 26 }, |
| 1313 | [0xb6] = { .c = 0xf3, .l = 26 }, |
| 1314 | [0xb7] = { .c = 0xf3, .l = 26 }, |
| 1315 | [0xb8] = { .c = 0xff, .l = 26 }, |
| 1316 | [0xb9] = { .c = 0xff, .l = 26 }, |
| 1317 | [0xba] = { .c = 0xff, .l = 26 }, |
| 1318 | [0xbb] = { .c = 0xff, .l = 26 }, |
| 1319 | [0xbc] = { .c = 0xcb, .l = 27 }, |
| 1320 | [0xbd] = { .c = 0xcb, .l = 27 }, |
| 1321 | [0xbe] = { .c = 0xcc, .l = 27 }, |
| 1322 | [0xbf] = { .c = 0xcc, .l = 27 }, |
| 1323 | [0xc0] = { .c = 0xd3, .l = 27 }, |
| 1324 | [0xc1] = { .c = 0xd3, .l = 27 }, |
| 1325 | [0xc2] = { .c = 0xd4, .l = 27 }, |
| 1326 | [0xc3] = { .c = 0xd4, .l = 27 }, |
| 1327 | [0xc4] = { .c = 0xd6, .l = 27 }, |
| 1328 | [0xc5] = { .c = 0xd6, .l = 27 }, |
| 1329 | [0xc6] = { .c = 0xdd, .l = 27 }, |
| 1330 | [0xc7] = { .c = 0xdd, .l = 27 }, |
| 1331 | [0xc8] = { .c = 0xde, .l = 27 }, |
| 1332 | [0xc9] = { .c = 0xde, .l = 27 }, |
| 1333 | [0xca] = { .c = 0xdf, .l = 27 }, |
| 1334 | [0xcb] = { .c = 0xdf, .l = 27 }, |
| 1335 | [0xcc] = { .c = 0xf1, .l = 27 }, |
| 1336 | [0xcd] = { .c = 0xf1, .l = 27 }, |
| 1337 | [0xce] = { .c = 0xf4, .l = 27 }, |
| 1338 | [0xcf] = { .c = 0xf4, .l = 27 }, |
| 1339 | [0xd0] = { .c = 0xf5, .l = 27 }, |
| 1340 | [0xd1] = { .c = 0xf5, .l = 27 }, |
| 1341 | [0xd2] = { .c = 0xf6, .l = 27 }, |
| 1342 | [0xd3] = { .c = 0xf6, .l = 27 }, |
| 1343 | [0xd4] = { .c = 0xf7, .l = 27 }, |
| 1344 | [0xd5] = { .c = 0xf7, .l = 27 }, |
| 1345 | [0xd6] = { .c = 0xf8, .l = 27 }, |
| 1346 | [0xd7] = { .c = 0xf8, .l = 27 }, |
| 1347 | [0xd8] = { .c = 0xfa, .l = 27 }, |
| 1348 | [0xd9] = { .c = 0xfa, .l = 27 }, |
| 1349 | [0xda] = { .c = 0xfb, .l = 27 }, |
| 1350 | [0xdb] = { .c = 0xfb, .l = 27 }, |
| 1351 | [0xdc] = { .c = 0xfc, .l = 27 }, |
| 1352 | [0xdd] = { .c = 0xfc, .l = 27 }, |
| 1353 | [0xde] = { .c = 0xfd, .l = 27 }, |
| 1354 | [0xdf] = { .c = 0xfd, .l = 27 }, |
| 1355 | [0xe0] = { .c = 0xfe, .l = 27 }, |
| 1356 | [0xe1] = { .c = 0xfe, .l = 27 }, |
| 1357 | [0xe2] = { .c = 0x02, .l = 28 }, |
| 1358 | [0xe3] = { .c = 0x03, .l = 28 }, |
| 1359 | [0xe4] = { .c = 0x04, .l = 28 }, |
| 1360 | [0xe5] = { .c = 0x05, .l = 28 }, |
| 1361 | [0xe6] = { .c = 0x06, .l = 28 }, |
| 1362 | [0xe7] = { .c = 0x07, .l = 28 }, |
| 1363 | [0xe8] = { .c = 0x08, .l = 28 }, |
| 1364 | [0xe9] = { .c = 0x0b, .l = 28 }, |
| 1365 | [0xea] = { .c = 0x0c, .l = 28 }, |
| 1366 | [0xeb] = { .c = 0x0e, .l = 28 }, |
| 1367 | [0xec] = { .c = 0x0f, .l = 28 }, |
| 1368 | [0xed] = { .c = 0x10, .l = 28 }, |
| 1369 | [0xee] = { .c = 0x11, .l = 28 }, |
| 1370 | [0xef] = { .c = 0x12, .l = 28 }, |
| 1371 | [0xf0] = { .c = 0x13, .l = 28 }, |
| 1372 | [0xf1] = { .c = 0x14, .l = 28 }, |
| 1373 | [0xf2] = { .c = 0x15, .l = 28 }, |
| 1374 | [0xf3] = { .c = 0x17, .l = 28 }, |
| 1375 | [0xf4] = { .c = 0x18, .l = 28 }, |
| 1376 | [0xf5] = { .c = 0x19, .l = 28 }, |
| 1377 | [0xf6] = { .c = 0x1a, .l = 28 }, |
| 1378 | [0xf7] = { .c = 0x1b, .l = 28 }, |
| 1379 | [0xf8] = { .c = 0x1c, .l = 28 }, |
| 1380 | [0xf9] = { .c = 0x1d, .l = 28 }, |
| 1381 | [0xfa] = { .c = 0x1e, .l = 28 }, |
| 1382 | [0xfb] = { .c = 0x1f, .l = 28 }, |
| 1383 | [0xfc] = { .c = 0x7f, .l = 28 }, |
| 1384 | [0xfd] = { .c = 0xdc, .l = 28 }, |
| 1385 | [0xfe] = { .c = 0xf9, .l = 28 }, |
| 1386 | [0xff] = { .c = 0x0a, .l = 30 }, |
| 1387 | /* Note, when l==30, bits 2..3 give 00:0x0a, 01:0x0d, 10:0x16, 11:EOS */ |
| 1388 | }; |
| 1389 | |
| 1390 | /* huffman-encode string <s> into the huff_tmp buffer and returns the amount |
| 1391 | * of output bytes. The caller must ensure the output is large enough (ie at |
| 1392 | * least 4 times as long as s). |
| 1393 | * |
| 1394 | * FIXME: bits are only counted for now, no code is emitted! |
| 1395 | */ |
| 1396 | int huff_enc(const char *s, char *out) |
| 1397 | { |
| 1398 | int bits = 0; |
| 1399 | |
| 1400 | while (*s) { |
| 1401 | bits += ht[(uint8_t)*s].b; |
| 1402 | s++; |
| 1403 | } |
| 1404 | bits += 7; |
| 1405 | |
| 1406 | /* FIXME: huffman code is not emitted yet. */ |
| 1407 | //memset(out, 'H', bits / 8); |
| 1408 | return bits / 8; |
| 1409 | } |
| 1410 | |
| 1411 | /* pass a huffman string, it will decode it and return the new output size or |
| 1412 | * -1 in case of error. |
| 1413 | * |
| 1414 | * The principle of the decoder is to lookup full bytes in reverse-huffman |
| 1415 | * tables. Since we may need up to 30 bits and the word positions are not |
| 1416 | * always multiples of 8, we build the code word by shifting the "current" |
| 1417 | * 32-bit word and the "next" one of the appropriate amount of bits. Once |
| 1418 | * the shift goes beyond 32, words are swapped and the "next" one is refilled |
| 1419 | * with new bytes. Shift operations are cheap when done a single time like this. |
| 1420 | * On 64-bit platforms it is possible to further improve this by storing both |
| 1421 | * of them in a single word. |
| 1422 | */ |
| 1423 | int huff_dec(const uint8_t *huff, int hlen, char *out, int olen) |
| 1424 | { |
| 1425 | char *out_start = out; |
| 1426 | char *out_end = out + olen; |
| 1427 | const uint8_t *huff_end = huff + hlen; |
| 1428 | uint32_t curr = 0; |
| 1429 | uint32_t next = 0; |
| 1430 | uint32_t shift; |
| 1431 | uint32_t code; /* The 30-bit code being looked up, MSB-aligned */ |
| 1432 | uint8_t sym; |
| 1433 | int bleft; /* bits left */ |
| 1434 | int l; |
| 1435 | |
| 1436 | code = 0; |
| 1437 | shift = 64; // start with an empty buffer |
| 1438 | bleft = hlen << 3; |
| 1439 | while (bleft > 0 && out != out_end) { |
| 1440 | while (shift >= 32) { |
| 1441 | curr = next; |
| 1442 | |
Willy Tarreau | fcce0e1 | 2022-04-01 17:16:44 +0200 | [diff] [blame] | 1443 | /* read up to 4 bytes into next */ |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1444 | next = 0; |
| 1445 | |
| 1446 | if (huff + 4 <= huff_end) { |
Willy Tarreau | fcce0e1 | 2022-04-01 17:16:44 +0200 | [diff] [blame] | 1447 | next = read_n32(huff); |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1448 | huff += 4; |
| 1449 | } |
| 1450 | else { |
| 1451 | /* note: we append 0 and not 0xff so that we can |
| 1452 | * distinguish shifted bits from a really inserted |
| 1453 | * EOS. |
| 1454 | */ |
Willy Tarreau | 17b4687 | 2022-04-01 17:12:08 +0200 | [diff] [blame] | 1455 | next = (((huff + 0 < huff_end) ? (uint32_t)huff[0] : 0x00) << 24) + |
| 1456 | (((huff + 1 < huff_end) ? (uint32_t)huff[1] : 0x00) << 16) + |
| 1457 | (((huff + 2 < huff_end) ? (uint32_t)huff[2] : 0x00) << 8) + |
| 1458 | ((huff + 3 < huff_end) ? (uint32_t)huff[3] : 0x00); |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1459 | huff = huff_end; |
| 1460 | } |
| 1461 | |
| 1462 | shift -= 32; |
| 1463 | } |
| 1464 | |
| 1465 | /* curr:next contain 64 bit of huffman code */ |
| 1466 | code = curr; |
| 1467 | if (shift) |
| 1468 | code = (code << shift) + (next >> (32 - shift)); |
| 1469 | |
| 1470 | /* now we necessarily have 32 bits available */ |
| 1471 | if ((code >> 24) < 0xfe) { |
| 1472 | /* single byte */ |
| 1473 | l = rht_bit31_24[code >> 24].l; |
| 1474 | sym = rht_bit31_24[code >> 24].c; |
| 1475 | } |
| 1476 | else if (((code >> 17) & 0xff) < 0xff) { |
| 1477 | /* two bytes, 0xfe + 2 bits or 0xff + 2..7 bits */ |
| 1478 | l = rht_bit24_17[(code >> 17) & 0xff].l; |
| 1479 | sym = rht_bit24_17[(code >> 17) & 0xff].c; |
| 1480 | } |
| 1481 | else if (((code >> 16) & 0xff) < 0xff) { /* 3..5 bits */ |
| 1482 | /* 0xff + 0xfe + 3..5 bits or |
| 1483 | * 0xff + 0xff + 5..8 bits for values till 0xf5 |
| 1484 | */ |
| 1485 | l = rht_bit15_11_fe[(code >> 11) & 0x1f].l; |
| 1486 | sym = rht_bit15_11_fe[(code >> 11) & 0x1f].c; |
| 1487 | } |
| 1488 | else if (((code >> 8) & 0xff) < 0xf6) { /* 5..8 bits */ |
| 1489 | /* that's 0xff + 0xff */ |
| 1490 | l = rht_bit15_8[(code >> 8) & 0xff].l; |
| 1491 | sym = rht_bit15_8[(code >> 8) & 0xff].c; |
| 1492 | } |
| 1493 | else { |
| 1494 | /* 0xff 0xff 0xf6..0xff */ |
| 1495 | l = rht_bit11_4[(code >> 4) & 0xff].l; |
| 1496 | if (l < 30) |
| 1497 | sym = rht_bit11_4[(code >> 4) & 0xff].c; |
| 1498 | else if ((code & 0xff) == 0xf0) |
| 1499 | sym = 10; |
| 1500 | else if ((code & 0xff) == 0xf4) |
| 1501 | sym = 13; |
| 1502 | else if ((code & 0xff) == 0xf8) |
| 1503 | sym = 22; |
| 1504 | else { // 0xfc : EOS |
| 1505 | break; |
| 1506 | } |
| 1507 | } |
| 1508 | |
| 1509 | if (!l || bleft - l < 0) |
| 1510 | break; |
| 1511 | |
| 1512 | bleft -= l; |
| 1513 | shift += l; |
| 1514 | *out++ = sym; |
| 1515 | } |
| 1516 | |
| 1517 | if (bleft > 0) { |
| 1518 | /* some bits were not consumed after the last code, they must |
Willy Tarreau | 4235d18 | 2017-12-03 12:00:36 +0100 | [diff] [blame] | 1519 | * match EOS (ie: all ones) and there must be 7 bits or less. |
| 1520 | * (7541#5.2). |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1521 | */ |
Willy Tarreau | 4235d18 | 2017-12-03 12:00:36 +0100 | [diff] [blame] | 1522 | if (bleft > 7) |
| 1523 | return -1; |
| 1524 | |
Willy Tarreau | a004ade | 2017-05-30 17:22:18 +0200 | [diff] [blame] | 1525 | if ((code & -(1 << (32 - bleft))) != (uint32_t)-(1 << (32 - bleft))) |
| 1526 | return -1; |
| 1527 | } |
| 1528 | |
| 1529 | if (out < out_end) |
| 1530 | *out = 0; // end of string whenever possible |
| 1531 | return out - out_start; |
| 1532 | } |