Skip to content

Instantly share code, notes, and snippets.

@incompl
Created September 20, 2012 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save incompl/3757489 to your computer and use it in GitHub Desktop.
Save incompl/3757489 to your computer and use it in GitHub Desktop.
var char = new Int8Array( 1 );
// uchar now shares the same ArrayBuffer as char.
var uchar = new Uint8Array( char.buffer );
char.buffer === uchar.buffer; // true
char[0] = -1;
uchar[0] === 255; // true, same data interpreted differently
var arr = new Float64Array([15.290663048624992]);
// { '0': 15.290663048624992,
// buffer:
// { '0': 0,
// '1': 0,
// '2': 128,
// '3': 201,
// '4': 209,
// '5': 148,
// '6': 46,
// '7': 64,
// byteLength: 8 },
// BYTES_PER_ELEMENT: 8,
// length: 1,
// set: [Function: set],
// slice: [Function: slice],
// byteOffset: 0,
// byteLength: 8,
// subarray: [Function: subarray] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment