Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup
  • Loading branch information
BridgeAR committed Apr 10, 2018
commit b895a85187c10a8b6af28b6d25c8519a7053b29b
6 changes: 4 additions & 2 deletions lib/internal/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {
ERR_OUT_OF_RANGE
} = require('internal/errors').codes;
const { setupBufferJS } = binding;
const { endianness } = require('os');

// Remove from the binding so that function is only available as exported here.
// (That is, for internal use only.)
Expand All @@ -20,7 +19,10 @@ const float64Array = new Float64Array(1);
const uInt8Float64Array = new Uint8Array(float64Array.buffer);

// Check endianness.
const bigEndian = endianness === 'BE';
float32Array[0] = -1; // 0xBF800000
// Either it is [0, 0, 128, 191] or [191, 128, 0, 0]. It is not possible to
// check this with `os.endianness()` because that is determined at compile time.
const bigEndian = uInt8Float32Array[3] === 0;

function checkBounds(buf, offset, byteLength) {
checkNumberType(offset);
Expand Down