avm2: Minor fix to string_wrapping_index

This improves the ecma3/String/substr test.
This commit is contained in:
Lord-McSweeney 2023-09-16 07:12:07 -07:00 committed by Adrian Wielgosik
parent 8aec2f1703
commit 6a1d0e32de
1 changed files with 1 additions and 1 deletions

View File

@ -716,7 +716,7 @@ fn string_index(i: f64, len: usize) -> usize {
/// Negative values will count backwards from `len`.
/// The returned index will be within the range of `[0, len]`.
fn string_wrapping_index(i: f64, len: usize) -> usize {
if i < 0. {
if (i as isize) < 0 {
if i.is_infinite() {
return 0;
}