[foozzie] Use Uint16Array to detect endianness
Converting from Uint32Array to Uint8Array will have"0" set as the first byte on BE machines: [0,0,AB,CD] Using Uint16Array will produce the correct result: [AB,CD] Change-Id: I9069f14c60a088a52af6d287c88be4ad437ee04d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064528 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com> Cr-Commit-Position: refs/heads/master@{#66357}
This commit is contained in:
parent
43accc8b7f
commit
ee13cd3ebc
@ -68,7 +68,7 @@ function testArrayType(arrayType, pattern) {
|
||||
testSameOptimized(pattern, create);
|
||||
}
|
||||
|
||||
var isBigEndian = new Uint8Array(new Uint32Array([0xABCD]).buffer)[0] === 0xAB;
|
||||
var isBigEndian = new Uint8Array(new Uint16Array([0xABCD]).buffer)[0] === 0xAB;
|
||||
testArrayType(Float32Array, [1065353216]);
|
||||
if (isBigEndian){
|
||||
testArrayType(Float64Array, [1072693248, 0]);
|
||||
|
Loading…
Reference in New Issue
Block a user