OLD | NEW |
1 /* | 1 /* |
2 * This code was written by Rich Felker in 2010; no copyright is claimed. | 2 * This code was written by Rich Felker in 2010; no copyright is claimed. |
3 * This code is in the public domain. Attribution is appreciated but | 3 * This code is in the public domain. Attribution is appreciated but |
4 * unnecessary. | 4 * unnecessary. |
5 */ | 5 */ |
6 | 6 |
7 #include "internal.h" | 7 #include "internal.h" |
8 | 8 |
9 #define C(x) ( x<2 ? -1 : ( R(0x80,0xc0) | x ) ) | 9 #define C(x) (x < 2 ? -1 : (R(0x80, 0xc0) | x)) |
10 #define D(x) C((x+16)) | 10 #define D(x) C((x + 16)) |
11 #define E(x) ( ( x==0 ? R(0xa0,0xc0) : \ | 11 #define E(x) \ |
12 x==0xd ? R(0x80,0xa0) : \ | 12 ((x == 0 ? R(0xa0, 0xc0) : x == 0xd ? R(0x80, 0xa0) : R(0x80, 0xc0)) | \ |
13 R(0x80,0xc0) ) \ | 13 (R(0x80, 0xc0) >> 6) | x) |
14 | ( R(0x80,0xc0) >> 6 ) \ | 14 #define F(x) \ |
15 | x ) | 15 ((x >= 5 ? 0 : x == 0 ? R(0x90, 0xc0) : x == 4 ? R(0x80, 0xa0) \ |
16 #define F(x) ( ( x>=5 ? 0 : \ | 16 : R(0x80, 0xc0)) | \ |
17 x==0 ? R(0x90,0xc0) : \ | 17 (R(0x80, 0xc0) >> 6) | (R(0x80, 0xc0) >> 12) | x) |
18 x==4 ? R(0x80,0xa0) : \ | |
19 R(0x80,0xc0) ) \ | |
20 | ( R(0x80,0xc0) >> 6 ) \ | |
21 | ( R(0x80,0xc0) >> 12 ) \ | |
22 | x ) | |
23 | 18 |
24 const uint32_t bittab[] = { | 19 const uint32_t bittab[] = { |
25 » C(0x2),C(0x3),C(0x4),C(0x5),C(0x6),C(0x7), | 20 C(0x2), C(0x3), C(0x4), C(0x5), C(0x6), C(0x7), C(0x8), C(0x9), C(0xa), |
26 » C(0x8),C(0x9),C(0xa),C(0xb),C(0xc),C(0xd),C(0xe),C(0xf), | 21 C(0xb), C(0xc), C(0xd), C(0xe), C(0xf), D(0x0), D(0x1), D(0x2), D(0x3), |
27 » D(0x0),D(0x1),D(0x2),D(0x3),D(0x4),D(0x5),D(0x6),D(0x7), | 22 D(0x4), D(0x5), D(0x6), D(0x7), D(0x8), D(0x9), D(0xa), D(0xb), D(0xc), |
28 » D(0x8),D(0x9),D(0xa),D(0xb),D(0xc),D(0xd),D(0xe),D(0xf), | 23 D(0xd), D(0xe), D(0xf), E(0x0), E(0x1), E(0x2), E(0x3), E(0x4), E(0x5), |
29 » E(0x0),E(0x1),E(0x2),E(0x3),E(0x4),E(0x5),E(0x6),E(0x7), | 24 E(0x6), E(0x7), E(0x8), E(0x9), E(0xa), E(0xb), E(0xc), E(0xd), E(0xe), |
30 » E(0x8),E(0x9),E(0xa),E(0xb),E(0xc),E(0xd),E(0xe),E(0xf), | 25 E(0xf), F(0x0), F(0x1), F(0x2), F(0x3), F(0x4)}; |
31 » F(0x0),F(0x1),F(0x2),F(0x3),F(0x4) | |
32 }; | |
OLD | NEW |