From 3d109f9c4c5f0249b75e7a79db64d53b1bbcfb93 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 2 Jun 2011 10:05:10 +0200 Subject: [PATCH] fix #314: Nasal not working on i386/32bit systems with gcc>=4.5.x Change magic Nasal reftag to encode a quiet NaN (qNaN) instead of a signaling NaN (sNaN), since sNaNs cannot pass cleanly through an FPU (an sNaN is always converted to a qNaN, even by simple FPU load/store instructions). gcc 4.5.x uses float load/store operations more aggressively to move our 64bit Nasal variables (naRef) around. Signed-off-by: Andy Ross --- simgear/nasal/data.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simgear/nasal/data.h b/simgear/nasal/data.h index 8f1715a3..deb4fbdc 100644 --- a/simgear/nasal/data.h +++ b/simgear/nasal/data.h @@ -49,10 +49,11 @@ // On 32 bit systems where the pointer is half the width of the // double, we store a special magic number in the structure to make -// the double a NaN. This must appear in the top bits of the double, +// the double a qNaN. This must appear in the top bits of the double, // which is why the structure layout is endianness-dependent. +// qNaN (quiet NaNs) use range 0x7ff80000-0x7fffffff -#define NASAL_REFTAG 0x7ff56789 // == 2,146,789,257 decimal +#define NASAL_REFTAG 0x7fff6789 // == 2,147,444,617 decimal #define IS_REF(r) ((r).ref.reftag == NASAL_REFTAG) #define PTR(r) ((r).ref.ptr) -- 2.39.5