@@ -18,12 +18,12 @@ protected override string GetLengthBitmapEarlyExit(MethodType methodType, ulong[
1818 return bitSet . Length == 1
1919 ? RenderWord ( bitSet [ 0 ] , methodType )
2020 : $$ """
21- switch (key.length() >> 6)
22- {
21+ switch (key.length() >> 6)
22+ {
2323 {{ RenderCases ( ) }}
24- default:
25- {{ RenderExit ( methodType ) }}
26- }
24+ default:
25+ {{ RenderExit ( methodType ) }}
26+ }
2727 """ ;
2828
2929 string RenderCases ( )
@@ -33,9 +33,9 @@ string RenderCases()
3333 for ( int i = 0 ; i < bitSet . Length ; i ++ )
3434 {
3535 sb . Append ( $ """
36- case { i . ToStringInvariant ( ) } :
37- { RenderWord ( bitSet [ i ] , methodType ) }
38- break;
36+ case { i . ToStringInvariant ( ) } :
37+ { RenderWord ( bitSet [ i ] , methodType ) }
38+ break;
3939
4040 """ ) ;
4141 }
@@ -46,8 +46,8 @@ string RenderCases()
4646
4747 protected override string GetValueEarlyExit < T > ( MethodType methodType , T min , T max ) =>
4848 $ """
49- if ({ ( min . Equals ( max ) ? $ "key != { map . ToValueLabel ( max ) } " : $ "key < { map . ToValueLabel ( min ) } || key > { map . ToValueLabel ( max ) } ") } )
50- { RenderExit ( methodType ) }
49+ if ({ ( min . Equals ( max ) ? $ "key != { map . ToValueLabel ( max ) } " : $ "key < { map . ToValueLabel ( min ) } || key > { map . ToValueLabel ( max ) } ") } )
50+ { RenderExit ( methodType ) }
5151 """ ;
5252
5353 protected override string GetValueBitMaskEarlyExit < T > ( MethodType methodType , ulong mask )
@@ -58,8 +58,8 @@ protected override string GetValueBitMaskEarlyExit<T>(MethodType methodType, ulo
5858 string maskLiteral = map . ToValueLabel ( maskValue , unsignedType ) ;
5959
6060 return $ """
61- if ((static_cast<{ unsignedTypeName } >(key) & { maskLiteral } ) != 0)
62- { RenderExit ( methodType ) }
61+ if ((static_cast<{ unsignedTypeName } >(key) & { maskLiteral } ) != 0)
62+ { RenderExit ( methodType ) }
6363 """ ;
6464 }
6565
@@ -74,8 +74,8 @@ protected override string GetLengthEqualEarlyExit(MethodType methodType, uint le
7474 } ;
7575
7676 return $ """
77- if (key.length() != { map . ToValueLabel ( lengthValue ) } )
78- { RenderExit ( methodType ) }
77+ if (key.length() != { map . ToValueLabel ( lengthValue ) } )
78+ { RenderExit ( methodType ) }
7979 """ ;
8080 }
8181
@@ -104,9 +104,9 @@ protected override string GetLengthRangeEarlyExit(MethodType methodType, uint mi
104104 }
105105
106106 return $ """
107- const size_t len = key.length();
108- if (len < { map . ToValueLabel ( minLen ) } || len > { map . ToValueLabel ( maxLen ) } )
109- { RenderExit ( methodType ) }
107+ const size_t len = key.length();
108+ if (len < { map . ToValueLabel ( minLen ) } || len > { map . ToValueLabel ( maxLen ) } )
109+ { RenderExit ( methodType ) }
110110 """ ;
111111 }
112112
@@ -115,8 +115,8 @@ protected override string GetLengthDivisorEarlyExit(MethodType methodType, uint
115115 Debug . Assert ( byteDivisor > 1 ) ;
116116
117117 return $ """
118- if (key.length() % { map . ToValueLabel ( byteDivisor ) } != 0)
119- { RenderExit ( methodType ) }
118+ if (key.length() % { map . ToValueLabel ( byteDivisor ) } != 0)
119+ { RenderExit ( methodType ) }
120120 """ ;
121121 }
122122
@@ -131,69 +131,69 @@ protected override string GetStringBitMaskEarlyExit(MethodType methodType, ulong
131131 if ( ! ignoreCase )
132132 {
133133 return $ """
134- uint64_t first = 0;
135- std::memcpy(&first, key.data(), { byteCount } );
134+ uint64_t first = 0;
135+ std::memcpy(&first, key.data(), { byteCount } );
136136
137- if ((first & { mask . ToStringInvariant ( ) } ULL) != 0)
138- { RenderExit ( methodType ) }
137+ if ((first & { mask . ToStringInvariant ( ) } ULL) != 0)
138+ { RenderExit ( methodType ) }
139139 """ ;
140140 }
141141
142142 StringBuilder sb = new StringBuilder ( ) ;
143- sb . Append ( " uint64_t first = 0;" ) ;
143+ sb . Append ( " uint64_t first = 0;" ) ;
144144
145145 for ( int i = 0 ; i < byteCount ; i ++ )
146146 {
147147 sb . Append ( $ """
148- uint32_t c{ i } = static_cast<uint32_t>(key[{ i } ]);
149- c{ i } = to_lower_ascii(c{ i } );
150- first |= static_cast<uint64_t>(c{ i } ) << { i * 8 } ;
148+ uint32_t c{ i } = static_cast<uint32_t>(key[{ i } ]);
149+ c{ i } = to_lower_ascii(c{ i } );
150+ first |= static_cast<uint64_t>(c{ i } ) << { i * 8 } ;
151151 """ ) ;
152152 }
153153
154154 sb . Append ( $ """
155155
156- if ((first & { mask . ToStringInvariant ( ) } ULL) != 0)
157- { RenderExit ( methodType ) }
156+ if ((first & { mask . ToStringInvariant ( ) } ULL) != 0)
157+ { RenderExit ( methodType ) }
158158 """ ) ;
159159 return sb . ToString ( ) ;
160160 }
161161
162162 protected override string GetCharRangeEarlyExit ( MethodType methodType , CharPosition position , char min , char max , bool ignoreCase , GeneratorEncoding encoding ) =>
163163 $ """
164- uint32_t valueChar = { ( position == CharPosition . First ?
165- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
166- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) } ;
167- if (valueChar < { map . ToValueLabel ( ( uint ) min ) } || valueChar > { map . ToValueLabel ( ( uint ) max ) } )
168- { RenderExit ( methodType ) }
164+ uint32_t valueChar = { ( position == CharPosition . First ?
165+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
166+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) } ;
167+ if (valueChar < { map . ToValueLabel ( ( uint ) min ) } || valueChar > { map . ToValueLabel ( ( uint ) max ) } )
168+ { RenderExit ( methodType ) }
169169 """ ;
170170
171171 protected override string GetCharEqualsEarlyExit ( MethodType methodType , CharPosition position , char value , bool ignoreCase , GeneratorEncoding encoding ) =>
172172 $ """
173- uint32_t valueChar = { ( position == CharPosition . First ?
174- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
175- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) } ;
176- if (valueChar != { map . ToValueLabel ( ( uint ) value ) } )
177- { RenderExit ( methodType ) }
173+ uint32_t valueChar = { ( position == CharPosition . First ?
174+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
175+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) } ;
176+ if (valueChar != { map . ToValueLabel ( ( uint ) value ) } )
177+ { RenderExit ( methodType ) }
178178 """ ;
179179
180180 protected override string GetCharBitmapEarlyExit ( MethodType methodType , CharPosition position , ulong low , ulong high , bool ignoreCase , GeneratorEncoding encoding ) =>
181181 $$ """
182- uint32_t valueChar = {{ ( position == CharPosition . First ?
183- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
184- ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) }} ;
185- if (valueChar > 0x7F)
182+ uint32_t valueChar = {{ ( position == CharPosition . First ?
183+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.front()))" : "static_cast<uint32_t>(key.front())" :
184+ ignoreCase ? "to_lower_ascii(static_cast<uint32_t>(key.back()))" : "static_cast<uint32_t>(key.back())" ) }} ;
185+ if (valueChar > 0x7F)
186+ {{ RenderExit ( methodType ) }}
187+ if (valueChar < 64)
188+ {
189+ if (((1ULL << valueChar) & {{ low . ToStringInvariant ( ) }} ULL) == 0)
186190 {{ RenderExit ( methodType ) }}
187- if (valueChar < 64)
188- {
189- if (((1ULL << valueChar) & {{ low . ToStringInvariant ( ) }} ULL) == 0)
190- {{ RenderExit ( methodType ) }}
191- }
192- else
193- {
194- if (((1ULL << (valueChar - 64)) & {{ high . ToStringInvariant ( ) }} ULL) == 0)
195- {{ RenderExit ( methodType ) }}
196- }
191+ }
192+ else
193+ {
194+ if (((1ULL << (valueChar - 64)) & {{ high . ToStringInvariant ( ) }} ULL) == 0)
195+ {{ RenderExit ( methodType ) }}
196+ }
197197 """ ;
198198
199199 protected override string GetStringPrefixSuffixEarlyExit ( MethodType methodType , string prefix , string suffix , bool ignoreCase )
@@ -208,15 +208,15 @@ protected override string GetStringPrefixSuffixEarlyExit(MethodType methodType,
208208 condition = suffix . Length == 0 ? prefixCheck : $ "{ prefixCheck } && { suffixCheck } ";
209209
210210 return $ """
211- if (!({ condition } ))
212- { RenderExit ( methodType ) }
211+ if (!({ condition } ))
212+ { RenderExit ( methodType ) }
213213 """ ;
214214 }
215215
216216 private static string RenderWord ( ulong word , MethodType methodType ) =>
217217 $ """
218- if (({ word . ToStringInvariant ( ) } ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
219- { RenderExit ( methodType ) }
218+ if (({ word . ToStringInvariant ( ) } ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
219+ { RenderExit ( methodType ) }
220220 """ ;
221221
222222 private static string RenderExit ( MethodType methodType ) => methodType == MethodType . TryLookup
0 commit comments