public static void SharedArrayBuffer_NonZeroLength(Function objectPrototype) { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal("[object SharedArrayBuffer]", objectPrototype.Call(d)); Assert.Equal(50, d.ByteLength); }
public static void SharedArrayBufferSliceAndDice3_SubsetFromTheBack(SharedArrayBuffer buffer) { Int32Array sliced = new Int32Array(buffer.Slice(-4)); Assert.Equal(1, sliced.Length); Assert.Equal(13, sliced[0]); }
public static void SharedArrayBufferSliceAndDiceAndUseThroughSpan() { // create a SharedArrayBuffer with a size in bytes SharedArrayBuffer buffer = new SharedArrayBuffer(16); Int32Array int32View = new Int32Array(buffer); // create view // produces Int32Array [0, 0, 0, 0] int32View[1] = 42; Assert.Equal(4, int32View.Length); Assert.Equal(42, int32View[1]); Int32Array sliced = new Int32Array(buffer.Slice(4, 12)); // expected output: Int32Array [42, 0] Span <int> nativeArray = sliced; int sum = 0; for (int i = 0; i < nativeArray.Length; i++) { sum += nativeArray[i]; } Assert.Equal(42, sum); }
public static EcmaValue SharedArrayBuffer([This] EcmaValue thisValue, EcmaValue length) { SharedArrayBuffer buffer = thisValue.GetUnderlyingObject <SharedArrayBuffer>(); buffer.Init(length.ToIndex()); return(thisValue); }
public static void SharedArrayBufferSliceAndDice3_Subset(SharedArrayBuffer buffer) { Int32Array sliced = new Int32Array(buffer.Slice(4, 12)); Assert.Equal(2, sliced.Length); Assert.Equal(42, sliced[0]); Assert.Equal(12, sliced[1]); }
public static EcmaValue Slice([This] EcmaValue thisValue, EcmaValue start, EcmaValue end) { SharedArrayBuffer buffer = thisValue.GetUnderlyingObject <SharedArrayBuffer>(); long startPos = ArrayHelper.GetBoundIndex(start, buffer.ByteLength, 0); long endPos = ArrayHelper.GetBoundIndex(end, buffer.ByteLength, buffer.ByteLength); return(buffer.Slice(startPos, endPos)); }
public static void SharedArrayBufferSliceAndDice3_SubsetFromTheBackWithEnd(SharedArrayBuffer buffer) { Int32Array sliced = new Int32Array(buffer.Slice(-12, -4)); Assert.Equal(2, sliced.Length); Assert.Equal(42, sliced[0]); Assert.Equal(12, sliced[1]); }
public static TheoryData <SharedArrayBuffer> GetTestData(int length) { // create a SharedArrayBuffer with a size in bytes SharedArrayBuffer buffer = new SharedArrayBuffer(length); Int32Array int32View = new Int32Array(buffer); // create view for (int i = 0; i < int32View.Length; i++) { int32View[i] = i + 10; } int32View[1] = 42; return(new TheoryData <SharedArrayBuffer> { buffer }); }
public static void SharedArrayBufferSliceAndDice() { // create a SharedArrayBuffer with a size in bytes SharedArrayBuffer buffer = new SharedArrayBuffer(16); Int32Array int32View = new Int32Array(buffer); // create view // produces Int32Array [0, 0, 0, 0] int32View[1] = 42; Assert.Equal(4, int32View.Length); Assert.Equal(42, int32View[1]); Int32Array sliced = new Int32Array(buffer.Slice(4, 12)); // expected output: Int32Array [42, 0] Assert.Equal(2, sliced.Length); Assert.Equal(42, sliced[0]); Assert.Equal(0, sliced[1]); }
public static void SharedArrayBuffer_Slice_BeginEndSubset() { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal(3, d.Slice(1, 4).ByteLength); }
public static void SharedArrayBuffer_Slice_BeginZero() { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal(50, d.Slice(0).ByteLength); }
public static void SharedArrayBuffer_Slice_BeginNegative() { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal(3, d.Slice(-3).ByteLength); }
public static void SharedArrayBufferSlice() { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal(50, d.Slice().ByteLength); }
public static void SharedArrayBuffer_Slice_BeginEndForFullArray() { SharedArrayBuffer d = new SharedArrayBuffer(50); Assert.Equal(50, d.Slice(0, 50).ByteLength); }
public static Float64Array Float64ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Float64Array(sab)); }
private static Int32Array Int32ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Int32Array(sab)); }
private static Float32Array Float32ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Float32Array(sab)); }
public static EcmaValue ByteLength([This] EcmaValue thisValue) { SharedArrayBuffer buffer = thisValue.GetUnderlyingObject <SharedArrayBuffer>(); return(buffer.ByteLength); }
public static Uint32Array Uint32ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Uint32Array(sab)); }
public void BufferSubData(UInt32 target, Int64 offset, SharedArrayBuffer data) { this.CallVoidMethod("bufferSubData", target, offset, data); }
public void BufferData(UInt32 target, SharedArrayBuffer data, UInt32 usage) { this.CallVoidMethod("bufferData", target, data, usage); }
public static void CoreTypes() { var arr = new Uint8ClampedArray(50); Assert.Equal(50, arr.Length); Assert.Equal(TypedArrayTypeCode.Uint8ClampedArray, arr.GetTypedArrayType()); var arr1 = new Uint8Array(50); Assert.Equal(50, arr1.Length); Assert.Equal(TypedArrayTypeCode.Uint8Array, arr1.GetTypedArrayType()); var arr2 = new Uint16Array(50); Assert.Equal(50, arr2.Length); Assert.Equal(TypedArrayTypeCode.Uint16Array, arr2.GetTypedArrayType()); var arr3 = new Uint32Array(50); Assert.Equal(50, arr3.Length); Assert.Equal(TypedArrayTypeCode.Uint32Array, arr3.GetTypedArrayType()); var arr4 = new Int8Array(50); Assert.Equal(50, arr4.Length); Assert.Equal(TypedArrayTypeCode.Int8Array, arr4.GetTypedArrayType()); var arr5 = new Int16Array(50); Assert.Equal(50, arr5.Length); Assert.Equal(TypedArrayTypeCode.Int16Array, arr5.GetTypedArrayType()); var arr6 = new Int32Array(50); Assert.Equal(50, arr6.Length); Assert.Equal(TypedArrayTypeCode.Int32Array, arr6.GetTypedArrayType()); var arr7 = new Float32Array(50); Assert.Equal(50, arr7.Length); Assert.Equal(TypedArrayTypeCode.Float32Array, arr7.GetTypedArrayType()); var arr8 = new Float64Array(50); Assert.Equal(50, arr8.Length); Assert.Equal(TypedArrayTypeCode.Float64Array, arr8.GetTypedArrayType()); var sharedArr40 = new SharedArrayBuffer(40); var sharedArr50 = new SharedArrayBuffer(50); var arr9 = new Uint8ClampedArray(sharedArr50); Assert.Equal(50, arr9.Length); var arr10 = new Uint8Array(sharedArr50); Assert.Equal(50, arr10.Length); var arr11 = new Uint16Array(sharedArr50); Assert.Equal(25, arr11.Length); var arr12 = new Uint32Array(sharedArr40); Assert.Equal(10, arr12.Length); var arr13 = new Int8Array(sharedArr50); Assert.Equal(50, arr13.Length); var arr14 = new Int16Array(sharedArr40); Assert.Equal(20, arr14.Length); var arr15 = new Int32Array(sharedArr40); Assert.Equal(10, arr15.Length); var arr16 = new Float32Array(sharedArr40); Assert.Equal(10, arr16.Length); var arr17 = new Float64Array(sharedArr40); Assert.Equal(5, arr17.Length); }
public static Int8Array Int8ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Int8Array(sab)); }
public void GetBufferSubData(UInt32 target, Int64 offset, SharedArrayBuffer returnedData) { this.CallVoidMethod("getBufferSubData", target, offset, returnedData); }
private static Uint16Array Uint16ArrayFromSharedArrayBuffer(SharedArrayBuffer sab) { return(new Uint16Array(sab)); }