@@ -217,37 +217,52 @@ function postInstantiate(baseModule, instance) {
217217
218218 baseModule . __getArrayBuffer = __getArrayBuffer ;
219219
220- function getTypedArrayImpl ( Type , alignLog2 , ptr ) {
220+ function getTypedArrayView ( Type , alignLog2 , ptr ) {
221221 const buffer = memory . buffer ;
222222 const U32 = new Uint32Array ( buffer ) ;
223223 const bufPtr = U32 [ ptr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2 ] ;
224224 return new Type ( buffer , bufPtr , U32 [ bufPtr + SIZE_OFFSET >>> 2 ] >>> alignLog2 ) ;
225225 }
226226
227+ function getTypedArray ( Type , alignLog2 , ptr ) {
228+ return new Type ( getTypedArrayView ( Type , alignLog2 , ptr ) ) ;
229+ }
230+
227231 /** Gets a view on the values of a known-to-be Int8Array in the module's memory. */
228- baseModule . __getInt8Array = getTypedArrayImpl . bind ( null , Int8Array , 0 ) ;
232+ baseModule . __getInt8Array = getTypedArray . bind ( null , Int8Array , 0 ) ;
233+ baseModule . __getInt8ArrayView = getTypedArrayView . bind ( null , Int8Array , 0 ) ;
229234 /** Gets a view on the values of a known-to-be Uint8Array in the module's memory. */
230- baseModule . __getUint8Array = getTypedArrayImpl . bind ( null , Uint8Array , 0 ) ;
235+ baseModule . __getUint8Array = getTypedArray . bind ( null , Uint8Array , 0 ) ;
236+ baseModule . __getUint8ArrayView = getTypedArrayView . bind ( null , Uint8Array , 0 ) ;
231237 /** Gets a view on the values of a known-to-be Uint8ClampedArray in the module's memory. */
232- baseModule . __getUint8ClampedArray = getTypedArrayImpl . bind ( null , Uint8ClampedArray , 0 ) ;
238+ baseModule . __getUint8ClampedArray = getTypedArray . bind ( null , Uint8ClampedArray , 0 ) ;
239+ baseModule . __getUint8ClampedArrayView = getTypedArrayView . bind ( null , Uint8ClampedArray , 0 ) ;
233240 /** Gets a view on the values of a known-to-be Int16Array in the module's memory. */
234- baseModule . __getInt16Array = getTypedArrayImpl . bind ( null , Int16Array , 1 ) ;
241+ baseModule . __getInt16Array = getTypedArray . bind ( null , Int16Array , 1 ) ;
242+ baseModule . __getInt16ArrayView = getTypedArrayView . bind ( null , Int16Array , 1 ) ;
235243 /** Gets a view on the values of a known-to-be Uint16Array in the module's memory. */
236- baseModule . __getUint16Array = getTypedArrayImpl . bind ( null , Uint16Array , 1 ) ;
244+ baseModule . __getUint16Array = getTypedArray . bind ( null , Uint16Array , 1 ) ;
245+ baseModule . __getUint16ArrayView = getTypedArrayView . bind ( null , Uint16Array , 1 ) ;
237246 /** Gets a view on the values of a known-to-be Int32Array in the module's memory. */
238- baseModule . __getInt32Array = getTypedArrayImpl . bind ( null , Int32Array , 2 ) ;
247+ baseModule . __getInt32Array = getTypedArray . bind ( null , Int32Array , 2 ) ;
248+ baseModule . __getInt32ArrayView = getTypedArrayView . bind ( null , Int32Array , 2 ) ;
239249 /** Gets a view on the values of a known-to-be Uint32Array in the module's memory. */
240- baseModule . __getUint32Array = getTypedArrayImpl . bind ( null , Uint32Array , 2 ) ;
250+ baseModule . __getUint32Array = getTypedArray . bind ( null , Uint32Array , 2 ) ;
251+ baseModule . __getUint32ArrayView = getTypedArrayView . bind ( null , Uint32Array , 2 ) ;
241252 if ( BIGINT ) {
242253 /** Gets a view on the values of a known-to-be-Int64Array in the module's memory. */
243- baseModule . __getInt64Array = getTypedArrayImpl . bind ( null , BigInt64Array , 3 ) ;
254+ baseModule . __getInt64Array = getTypedArray . bind ( null , BigInt64Array , 3 ) ;
255+ baseModule . __getInt64ArrayView = getTypedArrayView . bind ( null , BigInt64Array , 3 ) ;
244256 /** Gets a view on the values of a known-to-be-Uint64Array in the module's memory. */
245- baseModule . __getUint64Array = getTypedArrayImpl . bind ( null , BigUint64Array , 3 ) ;
257+ baseModule . __getUint64Array = getTypedArray . bind ( null , BigUint64Array , 3 ) ;
258+ baseModule . __getUint64ArrayView = getTypedArrayView . bind ( null , BigUint64Array , 3 ) ;
246259 }
247260 /** Gets a view on the values of a known-to-be Float32Array in the module's memory. */
248- baseModule . __getFloat32Array = getTypedArrayImpl . bind ( null , Float32Array , 2 ) ;
261+ baseModule . __getFloat32Array = getTypedArray . bind ( null , Float32Array , 2 ) ;
262+ baseModule . __getFloat32ArrayView = getTypedArrayView . bind ( null , Float32Array , 2 ) ;
249263 /** Gets a view on the values of a known-to-be Float64Array in the module's memory. */
250- baseModule . __getFloat64Array = getTypedArrayImpl . bind ( null , Float64Array , 3 ) ;
264+ baseModule . __getFloat64Array = getTypedArray . bind ( null , Float64Array , 3 ) ;
265+ baseModule . __getFloat64ArrayView = getTypedArrayView . bind ( null , Float64Array , 3 ) ;
251266
252267 /** Tests whether an object is an instance of the class represented by the specified base id. */
253268 function __instanceof ( ptr , baseId ) {
0 commit comments