Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: test/mjsunit/nans.js

Issue 551803004: Endian changes, support 64bit big endian (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Forwarded internalized strings use hash field slot, not offset Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/nans.js
diff --git a/test/mjsunit/nans.js b/test/mjsunit/nans.js
index 987ad6e78ef9ed4682ca3d081db0db8bb0dc43dc..5630e5b061c6a677855b4ff574740ae3aae53f62 100644
--- a/test/mjsunit/nans.js
+++ b/test/mjsunit/nans.js
@@ -27,6 +27,11 @@
// Flags: --allow-natives-syntax
+// Helper to determine endian - returns true on little endian platforms
+function isLittleEndian() {
+ return ((new Uint32Array((new Uint8Array([4,3,2,1])).buffer))[0])
+ == 0x01020304;
+}
// Test that both kinds of NaNs (signaling or quiet) do not signal
@@ -41,7 +46,11 @@ function TestAllModes(f) {
function TestDoubleSignalingNan() {
// NaN with signal bit set
function f() {
- var bytes = new Uint32Array([1, 0x7FF00000]);
+ if(isLittleEndian()) {
+ var bytes = new Uint32Array([1, 0x7FF00000]);
+ } else {
+ var bytes = new Uint32Array([0x7FF00000, 1]);
+ }
var doubles = new Float64Array(bytes.buffer);
assertTrue(isNaN(doubles[0]));
assertTrue(isNaN(doubles[0]*2.0));
@@ -56,7 +65,11 @@ TestDoubleSignalingNan();
function TestDoubleQuietNan() {
// NaN with signal bit cleared
function f() {
- var bytes = new Uint32Array([0, 0x7FF80000]);
+ if(isLittleEndian()) {
+ var bytes = new Uint32Array([0, 0x7FF80000]);
+ } else {
+ var bytes = new Uint32Array([0x7FF80000, 0]);
+ }
var doubles = new Float64Array(bytes.buffer);
assertTrue(isNaN(doubles[0]));
assertTrue(isNaN(doubles[0]*2.0));
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698