mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-17 08:51:34 +00:00
Add TypedArray#fill (#274)
This commit is contained in:
@ -119,11 +119,13 @@ export class Array<T> {
|
||||
start = start < 0 ? max(len + start, 0) : min(start, len);
|
||||
end = end < 0 ? max(len + end, 0) : min(end, len);
|
||||
if (sizeof<T>() == 1) {
|
||||
memory.fill(
|
||||
changetype<usize>(buffer) + start + HEADER_SIZE,
|
||||
<u8>value,
|
||||
<usize>(end - start)
|
||||
);
|
||||
if (start < end) {
|
||||
memory.fill(
|
||||
changetype<usize>(buffer) + start + HEADER_SIZE,
|
||||
<u8>value,
|
||||
<usize>(end - start)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
for (; start < end; ++start) {
|
||||
storeUnsafe<T,T>(buffer, start, value);
|
||||
|
Reference in New Issue
Block a user