mozjs60/tests-snans-be.patch

33 lines
1.1 KiB
Diff

From: Adrian Bunk <bunk@debian.org>
Date: Tue, 3 Jul 2018 10:03:37 +0100
Subject: Fix sort_snans.js test on big endian
Bug-Debian: https://bugs.debian.org/878285
---
js/src/tests/non262/TypedArray/sort_snans.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/js/src/tests/non262/TypedArray/sort_snans.js b/js/src/tests/non262/TypedArray/sort_snans.js
index 9e3ad16..df6cd52 100644
--- a/js/src/tests/non262/TypedArray/sort_snans.js
+++ b/js/src/tests/non262/TypedArray/sort_snans.js
@@ -34,6 +34,18 @@ function testFloat32NaNRanges(start, end) {
// and startHi, startLow and endHi, endLow should be 32-bit integers which,
// when combined (Hi + Low), form Float64 NaNs.
function testFloat64NaNRanges(startHi, startLow, endHi, endLow) {
+
+ // Swap on big endian platforms
+ if ((new Uint32Array((new Uint8Array([1,2,3,4])).buffer))[0] === 0x01020304) {
+ let tmp = startHi;
+ startHi = startLow;
+ startLow = tmp;
+
+ tmp = endHi;
+ endHi = endLow;
+ endLow = tmp;
+ }
+
let skipN = 10e6;
let sampleSizeHi = Math.floor((endHi - startHi)/skipN);