@@ -146,6 +146,44 @@ ada_really_inline constexpr bool contains_forbidden_domain_code_point(
146146 return accumulator;
147147}
148148
149+ constexpr static uint8_t is_forbidden_domain_code_point_table_or_upper[] = {
150+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
151+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ,
152+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 1 , 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
153+ 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 0 ,
154+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
155+ 0 , 0 , 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
156+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
157+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
158+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
159+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
160+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 };
161+
162+ static_assert (sizeof (is_forbidden_domain_code_point_table_or_upper) == 256 );
163+ static_assert (is_forbidden_domain_code_point_table_or_upper[uint8_t (' A' )] == 2 );
164+ static_assert (is_forbidden_domain_code_point_table_or_upper[uint8_t (' Z' )] == 2 );
165+
166+ ada_really_inline constexpr bool contains_forbidden_domain_code_point_or_upper (
167+ const char * input, size_t length) noexcept {
168+ size_t i = 0 ;
169+ uint8_t accumulator{};
170+ for (; i + 4 <= length; i += 4 ) {
171+ accumulator |=
172+ is_forbidden_domain_code_point_table_or_upper[uint8_t (input[i])];
173+ accumulator |=
174+ is_forbidden_domain_code_point_table_or_upper[uint8_t (input[i + 1 ])];
175+ accumulator |=
176+ is_forbidden_domain_code_point_table_or_upper[uint8_t (input[i + 2 ])];
177+ accumulator |=
178+ is_forbidden_domain_code_point_table_or_upper[uint8_t (input[i + 3 ])];
179+ }
180+ for (; i < length; i++) {
181+ accumulator |=
182+ is_forbidden_domain_code_point_table_or_upper[uint8_t (input[i])];
183+ }
184+ return accumulator;
185+ }
186+
149187static_assert (unicode::is_forbidden_domain_code_point(' %' ));
150188static_assert (unicode::is_forbidden_domain_code_point(' \x7f ' ));
151189static_assert (unicode::is_forbidden_domain_code_point(' \0 ' ));
0 commit comments