Created
July 22, 2016 21:11
-
-
Save eastlondoner/0e6763581a420eeaf3ce7a1caced3dfc to your computer and use it in GitHub Desktop.
Is this server big or little endian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var littleEndian = (function() { | |
| var buffer = new ArrayBuffer(2); | |
| new DataView(buffer).setInt16(0, 256, true /* littleEndian */); | |
| // Int16Array uses the platform's endianness. | |
| return new Int16Array(buffer)[0] === 256; | |
| })(); | |
| console.log(littleEndian ? 'little' : 'big'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment