UNPKG

3.95 kBTypeScriptView Raw
1export type Range = [number, number];
2export type Range0_1 = 0 | 1;
3export type Range0_3 = Range0_1 | 2 | 3;
4export type Range0_7 = Range0_3 | Range4_7;
5export type Range0_15 = Range0_7 | Range8_15;
6export type Range0_23 = Range0_15 | Range16_23;
7export type Range0_31 = Range0_15 | Range16_31;
8export type Range0_47 = Range0_31 | Range32_47;
9export type Range0_63 = Range0_31 | Range32_63;
10export type Range1_2 = 1 | 2;
11export type Range1_4 = Range1_2 | 3 | 4;
12export type Range1_8 = Range1_4 | Range4_7 | 8;
13export type Range1_16 = Range1_8 | Range8_15 | 16;
14export type Range1_24 = Range1_16 | Range16_23 | 24;
15export type Range1_32 = Range1_16 | Range16_31 | 32;
16export type Range1_48 = Range1_32 | Range32_47 | 48;
17export type Range1_64 = Range1_32 | Range32_63 | 64;
18export type Range4_7 = 4 | 5 | 6 | 7;
19export type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
20export type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
21export type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
22export type Range32_47 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47;
23export type Range48_63 = 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63;
24export type Range32_63 = Range32_47 | Range48_63;
25/**
26 * Type LUT of allowed range values `[0..n)` for given range size `n`.
27 *
28 * @example
29 * ```
30 * RangeValueMap[4] -> 0 | 1 | 2 | 3
31 * ```
32 */
33export interface RangeValueMap {
34 1: 0;
35 2: Range0_1;
36 3: Range0_1 | 2;
37 4: Range0_3;
38 5: Range0_3 | 4;
39 6: Range0_3 | 4 | 5;
40 7: Range0_3 | 4 | 5 | 6;
41 8: Range0_7;
42 9: Range0_7 | 8;
43 10: Range0_7 | 8 | 9;
44 11: Range0_7 | 8 | 9 | 10;
45 12: Range0_7 | 8 | 9 | 10 | 11;
46 13: Range0_7 | 8 | 9 | 10 | 11 | 12;
47 14: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13;
48 15: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;
49 16: Range0_15;
50 17: Range0_15 | 16;
51 18: Range0_15 | 16 | 17;
52 19: Range0_15 | 16 | 17 | 18;
53 20: Range0_15 | 16 | 17 | 18 | 19;
54 21: Range0_15 | 16 | 17 | 18 | 19 | 20;
55 22: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21;
56 23: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22;
57 24: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
58 25: Exclude<Range0_31, 25 | 26 | 27 | 28 | 29 | 30 | 31>;
59 26: Exclude<Range0_31, 26 | 27 | 28 | 29 | 30 | 31>;
60 27: Exclude<Range0_31, 27 | 28 | 29 | 30 | 31>;
61 28: Exclude<Range0_31, 28 | 29 | 30 | 31>;
62 29: Exclude<Range0_31, 29 | 30 | 31>;
63 30: Exclude<Range0_31, 30 | 31>;
64 31: Exclude<Range0_31, 31>;
65 32: Range0_31;
66 33: Range0_31 | 32;
67 34: Range0_31 | 32 | 33;
68 35: Range0_31 | 32 | 33 | 34;
69 36: Range0_31 | 32 | 33 | 34 | 35;
70 37: Range0_31 | 32 | 33 | 34 | 35 | 36;
71 38: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37;
72 39: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38;
73 40: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39;
74 41: Exclude<Range0_47, 41 | 42 | 43 | 44 | 45 | 46 | 47>;
75 42: Exclude<Range0_47, 42 | 43 | 44 | 45 | 46 | 47>;
76 43: Exclude<Range0_47, 43 | 44 | 45 | 46 | 47>;
77 44: Exclude<Range0_47, 44 | 45 | 46 | 47>;
78 45: Exclude<Range0_47, 45 | 46 | 47>;
79 46: Exclude<Range0_47, 46 | 47>;
80 47: Exclude<Range0_47, 47>;
81 48: Range0_47;
82 49: Range0_47 | 48;
83 50: Range0_47 | 48 | 49;
84 51: Range0_47 | 48 | 49 | 50;
85 52: Range0_47 | 48 | 49 | 50 | 51;
86 53: Range0_47 | 48 | 49 | 50 | 51 | 52;
87 54: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53;
88 55: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54;
89 56: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55;
90 57: Exclude<Range0_63, 57 | 58 | 59 | 60 | 61 | 62 | 63>;
91 58: Exclude<Range0_63, 58 | 59 | 60 | 61 | 62 | 63>;
92 59: Exclude<Range0_63, 59 | 60 | 61 | 62 | 63>;
93 60: Exclude<Range0_63, 60 | 61 | 62 | 63>;
94 61: Exclude<Range0_63, 61 | 62 | 63>;
95 62: Exclude<Range0_63, 62 | 63>;
96 63: Exclude<Range0_63, 63>;
97 64: Range0_63;
98}
99//# sourceMappingURL=range.d.ts.map
\No newline at end of file