1 // AUTOGENERATED FROM index-iso-8859-2.txt, ORIGINAL COMMENT FOLLOWS:
2 //
3 // Any copyright is dedicated to the Public Domain.
4 // https://creativecommons.org/publicdomain/zero/1.0/
5 //
6 // For details on index index-iso-8859-2.txt see the Encoding Standard
7 // https://encoding.spec.whatwg.org/
8 //
9 // Identifier: 9569c67f22d0b57790e1c407c6eecf227e4562322dc296de43cdab7a0152ec73
10 // Date: 2014-12-19
11 
12 static FORWARD_TABLE: &'static [u16] = &[
13     128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
14     143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
15     158, 159, 160, 260, 728, 321, 164, 317, 346, 167, 168, 352, 350, 356, 377,
16     173, 381, 379, 176, 261, 731, 322, 180, 318, 347, 711, 184, 353, 351, 357,
17     378, 733, 382, 380, 340, 193, 194, 258, 196, 313, 262, 199, 268, 201, 280,
18     203, 282, 205, 206, 270, 272, 323, 327, 211, 212, 336, 214, 215, 344, 366,
19     218, 368, 220, 221, 354, 223, 341, 225, 226, 259, 228, 314, 263, 231, 269,
20     233, 281, 235, 283, 237, 238, 271, 273, 324, 328, 243, 244, 337, 246, 247,
21     345, 367, 250, 369, 252, 253, 355, 729,
22 ];
23 
24 /// Returns the index code point for pointer `code` in this index.
25 #[inline]
forward(code: u8) -> u1626 pub fn forward(code: u8) -> u16 {
27     FORWARD_TABLE[(code - 0x80) as usize]
28 }
29 
30 static BACKWARD_TABLE_LOWER: &'static [u8] = &[
31     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132,
32     133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
33     148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 0, 0, 0,
34     164, 0, 0, 167, 168, 0, 0, 0, 0, 173, 0, 0, 176, 0, 0, 0, 180, 0, 0, 0,
35     184, 0, 0, 0, 0, 0, 0, 0, 0, 193, 194, 0, 196, 0, 0, 199, 0, 201, 0, 203,
36     0, 205, 206, 0, 0, 0, 0, 211, 212, 0, 214, 215, 0, 0, 218, 0, 220, 221, 0,
37     223, 0, 225, 226, 0, 228, 0, 0, 231, 0, 233, 0, 235, 0, 237, 238, 0, 0, 0,
38     0, 243, 244, 0, 246, 247, 0, 0, 250, 0, 252, 253, 0, 0, 0, 0, 195, 227,
39     161, 177, 198, 230, 0, 0, 0, 0, 200, 232, 207, 239, 208, 240, 0, 0, 0, 0,
40     0, 0, 202, 234, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 197, 229,
41     0, 0, 165, 181, 0, 0, 163, 179, 209, 241, 0, 0, 210, 242, 0, 0, 0, 0, 0, 0,
42     0, 213, 245, 0, 0, 192, 224, 0, 0, 216, 248, 166, 182, 0, 0, 170, 186, 169,
43     185, 222, 254, 171, 187, 0, 0, 0, 0, 0, 0, 0, 0, 217, 249, 219, 251, 0, 0,
44     0, 0, 0, 0, 0, 172, 188, 175, 191, 174, 190, 0, 0, 0, 0, 0, 0, 0, 0, 183,
45     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 255, 0, 178, 0, 189,
46     0, 0,
47 ];
48 
49 static BACKWARD_TABLE_UPPER: &'static [u16] = &[
50     0, 0, 0, 0, 0, 0, 0, 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 0, 176,
51     192, 208, 224, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
52     0, 0, 256, 272,
53 ];
54 
55 /// Returns the index pointer for code point `code` in this index.
56 #[inline]
backward(code: u32) -> u857 pub fn backward(code: u32) -> u8 {
58     let offset = (code >> 4) as usize;
59     let offset = if offset < 46 {BACKWARD_TABLE_UPPER[offset] as usize} else {0};
60     BACKWARD_TABLE_LOWER[offset + ((code & 15) as usize)]
61 }
62 
63 #[cfg(test)]
64 single_byte_tests!(
65     mod = iso_8859_2
66 );
67