libparted 3.6
Loading...
Searching...
No Matches
pt-limit.c
Go to the documentation of this file.
1/* ANSI-C code produced by gperf version 3.2.1 */
2/* Command-line: gperf -C -N pt_limit_lookup -n -t -s 6 -k '*' --language=ANSI-C pt-limit.gperf */
3
4#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27/* The character set is not based on ISO-646. */
28#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29#endif
30
31#line 1 "pt-limit.gperf"
32struct partition_limit
33{
34 char const *name;
35 uint64_t max_start_sector;
36 uint64_t max_length;
37};
38
39#define TOTAL_KEYWORDS 11
40#define MIN_WORD_LENGTH 3
41#define MAX_WORD_LENGTH 5
42#define MIN_HASH_VALUE 5
43#define MAX_HASH_VALUE 55
44/* maximum key range = 51, duplicates = 0 */
45
46#ifdef __GNUC__
47__inline
48#else
49#ifdef __cplusplus
50inline
51#endif
52#endif
53static unsigned int
54hash (register const char *str, register size_t len)
55{
56 static const unsigned char asso_values[] =
57 {
58 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
59 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
60 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
61 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
62 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
63 56, 56, 56, 56, 56, 56, 10, 5, 56, 56,
64 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
65 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
66 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
67 56, 56, 56, 56, 56, 56, 56, 5, 40, 40,
68 5, 56, 56, 5, 20, 0, 56, 56, 15, 0,
69 15, 10, 0, 56, 0, 5, 0, 10, 15, 56,
70 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
71 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
72 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
73 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
74 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
75 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
76 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
77 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
78 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
79 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
80 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
81 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
82 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
83 56, 56, 56, 56, 56, 56
84 };
85 register unsigned int hval = 0;
86
87 switch (len)
88 {
89 default:
90 hval += asso_values[(unsigned char)str[4]];
91#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
92 [[fallthrough]];
93#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
94 __attribute__ ((__fallthrough__));
95#endif
96 /*FALLTHROUGH*/
97 case 4:
98 hval += asso_values[(unsigned char)str[3]];
99#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
100 [[fallthrough]];
101#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
102 __attribute__ ((__fallthrough__));
103#endif
104 /*FALLTHROUGH*/
105 case 3:
106 hval += asso_values[(unsigned char)str[2]];
107#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
108 [[fallthrough]];
109#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
110 __attribute__ ((__fallthrough__));
111#endif
112 /*FALLTHROUGH*/
113 case 2:
114 hval += asso_values[(unsigned char)str[1]];
115#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
116 [[fallthrough]];
117#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
118 __attribute__ ((__fallthrough__));
119#endif
120 /*FALLTHROUGH*/
121 case 1:
122 hval += asso_values[(unsigned char)str[0]];
123 break;
124 }
125 return hval;
126}
127
128const struct partition_limit *
129pt_limit_lookup (register const char *str, register size_t len)
130{
131#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
132#pragma GCC diagnostic push
133#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
134#endif
135 static const struct partition_limit wordlist[] =
136 {
137 {""}, {""}, {""}, {""}, {""},
138#line 10 "pt-limit.gperf"
139 {"gpt",UINT64_MAX,UINT64_MAX},
140 {""}, {""}, {""}, {""},
141#line 28 "pt-limit.gperf"
142 {"atari",INT32_MAX,INT32_MAX},
143 {""}, {""}, {""}, {""},
144#line 27 "pt-limit.gperf"
145 {"amiga",UINT32_MAX,UINT32_MAX},
146 {""}, {""}, {""}, {""},
147#line 8 "pt-limit.gperf"
148 {"dasd",UINT32_MAX,UINT32_MAX},
149 {""}, {""}, {""}, {""},
150#line 12 "pt-limit.gperf"
151 {"msdos",UINT32_MAX,UINT32_MAX},
152 {""}, {""}, {""}, {""},
153#line 18 "pt-limit.gperf"
154 {"sun",128ULL*UINT32_MAX,UINT32_MAX},
155 {""}, {""}, {""}, {""},
156#line 23 "pt-limit.gperf"
157 {"loop",UINT64_MAX,UINT64_MAX},
158 {""}, {""}, {""}, {""},
159#line 9 "pt-limit.gperf"
160 {"dvh",UINT32_MAX,UINT32_MAX},
161 {""}, {""}, {""}, {""},
162#line 11 "pt-limit.gperf"
163 {"mac",UINT32_MAX,UINT32_MAX},
164 {""}, {""}, {""}, {""},
165#line 20 "pt-limit.gperf"
166 {"bsd",UINT32_MAX,UINT32_MAX},
167 {""}, {""}, {""}, {""},
168#line 24 "pt-limit.gperf"
169 {"pc98",UINT32_MAX,UINT32_MAX}
170 };
171#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
172#pragma GCC diagnostic pop
173#endif
174
175 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
176 {
177 register unsigned int key = hash (str, len);
178
179 if (key <= MAX_HASH_VALUE)
180 {
181 register const char *s = wordlist[key].name;
182
183 if (*str == *s && !strcmp (str + 1, s + 1))
184 return &wordlist[key];
185 }
186 }
187 return (struct partition_limit *) 0;
188}