Enable TypedArray support at runtime (IE9 is still the outlier)
This commit is contained in:
parent
9024f00e11
commit
ade000d0a5
9 changed files with 428 additions and 428 deletions
|
|
@ -106,7 +106,7 @@ var FATARRAYS = false;
|
|||
*
|
||||
* See the Memory component for details.
|
||||
*/
|
||||
var TYPEDARRAYS = (typeof window.ArrayBuffer !== 'undefined');
|
||||
var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
global.PCJSCLASS = PCJSCLASS;
|
||||
|
|
|
|||
|
|
@ -133,16 +133,16 @@ function Memory(addr, size, fReadOnly, controller) {
|
|||
* know how to deal with this simple 1-1 mapping of addresses to bytes and words.
|
||||
*/
|
||||
if (TYPEDARRAYS) {
|
||||
this.buffer = new window.ArrayBuffer(size);
|
||||
this.buffer = new ArrayBuffer(size);
|
||||
/**
|
||||
* @type {DataView}
|
||||
*/
|
||||
this.dv = new window.DataView(this.buffer, 0, size);
|
||||
this.dv = new DataView(this.buffer, 0, size);
|
||||
/*
|
||||
* We could also use dv.getUint8() and dv.setUint8(), but using ab[] to get/set bytes
|
||||
* in this.buffer is more convenient and presents no "endianness" issues.
|
||||
*/
|
||||
this.ab = new window.Uint8Array(this.buffer, 0, size);
|
||||
this.ab = new Uint8Array(this.buffer, 0, size);
|
||||
this.setAccess(Memory.afnTypedArray);
|
||||
} else {
|
||||
if (FATARRAYS) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue