mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-16 16:31:32 +00:00
simplify
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { runtime, ArrayBufferView } from "./runtime";
|
||||
import { gc } from "./gc";
|
||||
import { COMPARATOR, SORT as SORT_IMPL } from "./util/sort";
|
||||
|
||||
function clampToByte(value: i32): i32 {
|
||||
@ -759,11 +760,11 @@ function SUBARRAY<TArray extends ArrayBufferView, T>(
|
||||
else begin = min(begin, length);
|
||||
if (end < 0) end = max(length + end, begin);
|
||||
else end = max(min(end, length), begin);
|
||||
var out = runtime.allocRaw(offsetof<TArray>());
|
||||
var out = runtime.alloc(offsetof<TArray>());
|
||||
store<usize>(out, buffer, offsetof<TArray>("buffer"));
|
||||
store<usize>(out, array.dataStart + (<usize>begin << alignof<T>()) , offsetof<TArray>("dataStart"));
|
||||
store<usize>(out, array.dataStart + (<usize>begin << alignof<T>()) , offsetof<TArray>("dataStart"));
|
||||
store<usize>(out, array.dataEnd + (<usize>(end - begin) << alignof<T>()), offsetof<TArray>("dataEnd"));
|
||||
runtime.link(buffer, runtime.register<TArray>(out)); // register first, then link
|
||||
gc.link(buffer, gc.register<TArray>(out)); // register first, then link
|
||||
return changetype<TArray>(out);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user