mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-28 16:32:15 +00:00
fix
This commit is contained in:
parent
707f2dae9a
commit
e581f254d0
@ -1,3 +1,5 @@
|
|||||||
|
import { compareImpl } from "./string";
|
||||||
|
|
||||||
@inline export function COMPARATOR<T>(): (a: T, b: T) => i32 {
|
@inline export function COMPARATOR<T>(): (a: T, b: T) => i32 {
|
||||||
if (isInteger<T>()) {
|
if (isInteger<T>()) {
|
||||||
if (isSigned<T>() && sizeof<T>() <= 4) {
|
if (isSigned<T>() && sizeof<T>() <= 4) {
|
||||||
@ -31,7 +33,7 @@
|
|||||||
if (!alen && !blen) return 0;
|
if (!alen && !blen) return 0;
|
||||||
if (!alen) return -1;
|
if (!alen) return -1;
|
||||||
if (!blen) return 1;
|
if (!blen) return 1;
|
||||||
return String.cmp(<string>a, 0, <string>b, 0, <usize>min(alen, blen));
|
return compareImpl(<string>a, 0, <string>b, 0, <usize>min(alen, blen));
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return (a: T, b: T): i32 => (<i32>(a > b) - <i32>(a < b));
|
return (a: T, b: T): i32 => (<i32>(a > b) - <i32>(a < b));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user