Implement Uint8ClampedArray (#82)

This commit is contained in:
Max Graey
2018-04-24 01:33:21 +03:00
committed by Daniel Wirtz
parent 63aa648ace
commit ddde13a648
5 changed files with 942 additions and 373 deletions

View File

@ -33,7 +33,7 @@ export abstract class TypedArray<T> implements ArrayBufferView<T> {
}
@operator("[]")
private __get(index: i32): T {
protected __get(index: i32): T {
var byteOffset = this.byteOffset;
var elementLength = (this.byteLength - byteOffset) >>> alignof<T>();
if (<u32>index >= <u32>elementLength) throw new Error("Index out of bounds");
@ -41,7 +41,7 @@ export abstract class TypedArray<T> implements ArrayBufferView<T> {
}
@operator("[]=")
private __set(index: i32, value: T): void {
protected __set(index: i32, value: T): void {
var byteOffset = this.byteOffset;
var elementLength = (this.byteLength - byteOffset) >>> alignof<T>();
if (<u32>index >= <u32>elementLength) throw new Error("Index out of bounds");