mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-15 16:01:30 +00:00
Implement TypedArray#reverse (#532)
This commit is contained in:
@ -10,6 +10,7 @@ import {
|
||||
SOME,
|
||||
EVERY,
|
||||
FOREACH,
|
||||
REVERSE,
|
||||
} from "./internal/typedarray";
|
||||
|
||||
import {
|
||||
@ -68,6 +69,10 @@ export class Int8Array extends TypedArray<i8> {
|
||||
forEach(callbackfn: (value: i8, index: i32, self: Int8Array) => void): void {
|
||||
FOREACH<Int8Array, i8>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, i8>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Uint8Array extends TypedArray<u8> {
|
||||
@ -118,6 +123,10 @@ export class Uint8Array extends TypedArray<u8> {
|
||||
forEach(callbackfn: (value: u8, index: i32, self: Uint8Array) => void): void {
|
||||
FOREACH<Uint8Array, u8>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, u8>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Uint8ClampedArray extends Uint8Array {
|
||||
@ -178,6 +187,10 @@ export class Uint8ClampedArray extends Uint8Array {
|
||||
forEach(callbackfn: (value: u8, index: i32, self: Uint8ClampedArray) => void): void {
|
||||
FOREACH<Uint8ClampedArray, u8>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, u8>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Int16Array extends TypedArray<i16> {
|
||||
@ -228,6 +241,10 @@ export class Int16Array extends TypedArray<i16> {
|
||||
forEach(callbackfn: (value: i16, index: i32, self: Int16Array) => void): void {
|
||||
FOREACH<Int16Array, i16>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, i16>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Uint16Array extends TypedArray<u16> {
|
||||
@ -278,6 +295,10 @@ export class Uint16Array extends TypedArray<u16> {
|
||||
forEach(callbackfn: (value: u16, index: i32, self: Uint16Array) => void): void {
|
||||
FOREACH<Uint16Array, u16>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, u16>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Int32Array extends TypedArray<i32> {
|
||||
@ -328,6 +349,10 @@ export class Int32Array extends TypedArray<i32> {
|
||||
forEach(callbackfn: (value: i32, index: i32, self: Int32Array) => void): void {
|
||||
FOREACH<Int32Array, i32>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, i32>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Uint32Array extends TypedArray<u32> {
|
||||
@ -378,6 +403,10 @@ export class Uint32Array extends TypedArray<u32> {
|
||||
forEach(callbackfn: (value: u32, index: i32, self: Uint32Array) => void): void {
|
||||
FOREACH<Uint32Array, u32>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, u32>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Int64Array extends TypedArray<i64> {
|
||||
@ -428,6 +457,10 @@ export class Int64Array extends TypedArray<i64> {
|
||||
forEach(callbackfn: (value: i64, index: i32, self: Int64Array) => void): void {
|
||||
FOREACH<Int64Array, i64>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, i64>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Uint64Array extends TypedArray<u64> {
|
||||
@ -478,6 +511,10 @@ export class Uint64Array extends TypedArray<u64> {
|
||||
forEach(callbackfn: (value: u64, index: i32, self: Uint64Array) => void): void {
|
||||
FOREACH<Uint64Array, u64>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, u64>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Float32Array extends TypedArray<f32> {
|
||||
@ -528,6 +565,10 @@ export class Float32Array extends TypedArray<f32> {
|
||||
forEach(callbackfn: (value: f32, index: i32, self: Float32Array) => void): void {
|
||||
FOREACH<Float32Array, f32>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, f32>(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Float64Array extends TypedArray<f64> {
|
||||
@ -578,4 +619,8 @@ export class Float64Array extends TypedArray<f64> {
|
||||
forEach(callbackfn: (value: f64, index: i32, self: Float64Array) => void): void {
|
||||
FOREACH<Float64Array, f64>(this, callbackfn);
|
||||
}
|
||||
|
||||
reverse(): this {
|
||||
return REVERSE<this, f64>(this);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user