|
1 | 1 | use crate::_comparison_tools::lt::{assert_gt_240_bit, assert_lt_240_bit, lt_field_16_bit};
|
2 |
| -use crate::_string_tools::string_chopper::StringChopper; |
| 2 | +use crate::_string_tools::string_chopper::slice_string; |
3 | 3 | use crate::enums::Layer::ARRAY_LAYER;
|
4 | 4 | use crate::json::JSON;
|
5 | 5 | use crate::json_entry::JSONEntry;
|
@@ -179,60 +179,9 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
|
179 | 179 | "get_string, string size is larger than StringBytes",
|
180 | 180 | );
|
181 | 181 |
|
182 |
| - let mut result: [u8; StringBytes] = [0; StringBytes]; |
183 |
| - if (StringBytes <= 31) { |
184 |
| - let s: StringChopper<1> = StringChopper {}; |
185 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
186 |
| - } else if (StringBytes <= 62) { |
187 |
| - let s: StringChopper<2> = StringChopper {}; |
188 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
189 |
| - } else if (StringBytes <= 93) { |
190 |
| - let s: StringChopper<3> = StringChopper {}; |
191 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
192 |
| - } else if (StringBytes <= 124) { |
193 |
| - let s: StringChopper<4> = StringChopper {}; |
194 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
195 |
| - } else if (StringBytes <= 155) { |
196 |
| - let s: StringChopper<5> = StringChopper {}; |
197 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
198 |
| - } else if (StringBytes <= 186) { |
199 |
| - let s: StringChopper<6> = StringChopper {}; |
200 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
201 |
| - } else if (StringBytes <= 217) { |
202 |
| - let s: StringChopper<7> = StringChopper {}; |
203 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
204 |
| - } else if (StringBytes <= 248) // 8 |
205 |
| - { |
206 |
| - let s: StringChopper<8> = StringChopper {}; |
207 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
208 |
| - } else if (StringBytes <= 496) // 16 |
209 |
| - { |
210 |
| - let s: StringChopper<16> = StringChopper {}; |
211 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
212 |
| - } else if (StringBytes <= 992) // 32 |
213 |
| - { |
214 |
| - let s: StringChopper<32> = StringChopper {}; |
215 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
216 |
| - } else if (StringBytes <= 1984) { |
217 |
| - let s: StringChopper<64> = StringChopper {}; |
218 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
219 |
| - } else if (StringBytes <= 3968) { |
220 |
| - let s: StringChopper<128> = StringChopper {}; |
221 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
222 |
| - } else if (StringBytes <= 7936) { |
223 |
| - let s: StringChopper<256> = StringChopper {}; |
224 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
225 |
| - } else if (StringBytes <= 15872) { |
226 |
| - let s: StringChopper<512> = StringChopper {}; |
227 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
228 |
| - } else if (StringBytes <= 31774) { |
229 |
| - let s: StringChopper<1024> = StringChopper {}; |
230 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
231 |
| - } else { |
232 |
| - // max 16 bits = 65535 = 2115 31-byte slices |
233 |
| - let s: StringChopper<2115> = StringChopper {}; |
234 |
| - result = s.slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
235 |
| - } |
| 182 | + let result: [u8; StringBytes] = |
| 183 | + slice_string(self.json_packed, entry.json_pointer, entry.json_length); |
| 184 | + |
236 | 185 | result
|
237 | 186 | }
|
238 | 187 |
|
|
0 commit comments