Add String.fromCodePoint and 16-bit string compare (#174)

This commit is contained in:
Max Graey
2018-07-23 15:32:55 +03:00
committed by Daniel Wirtz
parent 1ecf85bf7c
commit 298a8f1688
15 changed files with 3188 additions and 3191 deletions

View File

@ -152,3 +152,11 @@ export function parse<T>(str: String, radix: i32 = 0): T {
}
return sign * num;
}
export function compareUTF16(ptr1: usize, ptr2: usize, len: usize): i32 {
var cmp: i32 = 0;
while (len && !(cmp = <i32>load<u16>(ptr1, HEADER_SIZE) - <i32>load<u16>(ptr2, HEADER_SIZE))) {
--len, ++ptr1, ++ptr2;
}
return cmp;
}