File tree 1 file changed +9
-7
lines changed 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -292,17 +292,19 @@ std::vector<mp_integer> string_concatenation_builtin_functiont::eval(
292
292
const std::vector<mp_integer> &input2_value,
293
293
const std::vector<mp_integer> &args_value) const
294
294
{
295
- const std::size_t start_index =
296
- args_value.size () > 0 && args_value[0 ] > 0 ? args_value[0 ].to_ulong () : 0 ;
297
- const std::size_t end_index = args_value.size () > 1 && args_value[1 ] > 0
298
- ? args_value[1 ].to_ulong ()
299
- : input2_value.size ();
295
+ const auto start_index =
296
+ args_value.size () > 0 && args_value[0 ] > 0 ? args_value[0 ] : mp_integer (0 );
297
+ const mp_integer input2_size (input2_value.size ());
298
+ const auto end_index =
299
+ args_value.size () > 1
300
+ ? std::max (std::min (args_value[1 ], input2_size), start_index)
301
+ : input2_size;
300
302
301
303
std::vector<mp_integer> result (input1_value);
302
304
result.insert (
303
305
result.end (),
304
- input2_value.begin () + start_index,
305
- input2_value.begin () + end_index);
306
+ input2_value.begin () + numeric_cast_v<std:: size_t >( start_index) ,
307
+ input2_value.begin () + numeric_cast_v<std:: size_t >( end_index) );
306
308
return result;
307
309
}
308
310
You can’t perform that action at this time.
0 commit comments