mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-21 18:51:43 +00:00
Add built-in valueof type
This commit is contained in:
2
std/assembly/index.d.ts
vendored
2
std/assembly/index.d.ts
vendored
@ -882,6 +882,8 @@ declare namespace v8x16 {
|
||||
}
|
||||
/** Macro type evaluating to the underlying native WebAssembly type. */
|
||||
declare type native<T> = T;
|
||||
/** Special type evaluating the value type of a collection. */
|
||||
declare type valueof<T extends unknown[]> = T[0];
|
||||
|
||||
/** Pseudo-class representing the backing class of integer types. */
|
||||
declare class _Integer {
|
||||
|
@ -1068,7 +1068,7 @@ function FOREACH<TArray extends ArrayBufferView, T>(
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
export function REVERSE<TArray extends ArrayBufferView, T>(array: TArray): TArray {
|
||||
function REVERSE<TArray extends ArrayBufferView, T>(array: TArray): TArray {
|
||||
var dataStart = array.dataStart;
|
||||
for (let front = 0, back = array.length - 1; front < back; ++front, --back) {
|
||||
let frontPtr = dataStart + (<usize>front << alignof<T>());
|
||||
|
Reference in New Issue
Block a user