Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions std/assembly/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ import { Array } from "./array";
var rightLength = right.length;
if (!rightLength) return true;
// @ts-ignore: string <-> String
return compareImpl(left, 0, right, 0, min(leftLength, rightLength)) > 0;
var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));
return res == 0 ? leftLength > rightLength : res > 0;
}

@operator(">=") private static __gte(left: String, right: String): bool {
Expand All @@ -136,7 +137,8 @@ import { Array } from "./array";
var leftLength = left.length;
if (!leftLength) return true;
// @ts-ignore: string <-> String
return compareImpl(left, 0, right, 0, min(leftLength, rightLength)) < 0;
var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));
return res == 0 ? leftLength < rightLength : res < 0;
}

@operator("<=") private static __lte(left: String, right: String): bool {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/std/string-encoding.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,7 @@
if
i32.const 0
i32.const 1504
i32.const 740
i32.const 742
i32.const 7
call $~lib/builtins/abort
unreachable
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/std/string-encoding.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -4388,7 +4388,7 @@
if
i32.const 0
i32.const 480
i32.const 740
i32.const 742
i32.const 7
call $~lib/builtins/abort
unreachable
Expand Down
Loading