make std/string test ok again

This commit is contained in:
dcode
2019-03-16 14:48:22 +01:00
parent 05a35f42f6
commit 0c388ca4c6
9 changed files with 3929 additions and 4779 deletions

View File

@ -346,12 +346,14 @@ export class Array<T> extends ArrayBufferView {
}
reverse(): Array<T> {
var base = this.dataStart;
for (let front = 0, back = this.length_ - 1; front < back; ++front, --back) {
let temp = load<T>(base, front);
let dest = base + (<usize>back << alignof<T>());
store<T>(base + (<usize>front << alignof<T>()), load<T>(dest));
store<T>(dest, temp);
var front = this.dataStart;
var back = this.dataEnd - sizeof<T>();
while (front < back) {
let temp = load<T>(front);
store<T>(front, load<T>(back));
store<T>(back, temp);
front += sizeof<T>();
back -= sizeof<T>();
}
return this;
}