]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/naref.h
Nasal: allow ghost as 'me' for 'call'
[simgear.git] / simgear / nasal / naref.h
index 918b4c2124bff71f0b766bd579921e9e144de159..66ddedb822ed21ad2beaa14c4187c5bd70ba5828 100644 (file)
@@ -5,15 +5,21 @@
  * platform-dependent endianness headers, just detect the platforms we
  * support.  This list is simpler and smaller, yet still quite
  * complete. */
-#if (defined(__x86_64) && defined(__linux__)) || defined(__sparcv9)
+#if (defined(__x86_64) && defined(__linux__)) || defined(__sparcv9) || \
+    defined(__powerpc64__)
 /* Win64 and Irix should work with this too, but have not been
  * tested */
-#   define NASAL_NAN64
-#elif defined(_M_IX86)   || defined(i386)    || defined(__x86_64) || \
-    defined(__ia64__) || defined(_M_IA64) || defined(__ARMEL__) 
+# define NASAL_NAN64
+#elif defined(_M_IX86) || defined(i386) || defined(__x86_64) || \
+      defined(__ia64__) || defined(_M_IA64) || defined(__ARMEL__) || \
+      defined(_M_X64) || defined(__alpha__) || \
+      (defined(__sh__) && defined(__LITTLE_ENDIAN__))
 # define NASAL_LE
-#elif defined(__sparc) || defined(__ppc__) || defined(__mips) || \
-      defined(__ARMEB__)
+#elif defined(__sparc) || defined(__ppc__) || defined(__PPC) || \
+      defined (__powerpc__) || defined (__powerpc64__) || defined (__alpha__) || \
+      defined(__mips) || defined(__ARMEB__) || \
+      defined(__hppa__) || defined(__s390__) || defined(__s390x__) || \
+      (defined(__sh__) && !defined(__LITTLE_ENDIAN__))
 # define NASAL_BE
 #else
 # error Unrecognized CPU architecture
@@ -30,30 +36,24 @@ typedef union {
     struct naGhost* ghost;
 } naPtr;
 
-#if defined(NASAL_NAN64)
-
-/* On suppoted 64 bit platforms (those where all memory returned from
+/* On supported 64 bit platforms (those where all memory returned from
  * naAlloc() is guaranteed to lie between 0 and 2^48-1) we union the
  * double with the pointer, and use fancy tricks (see data.h) to make
- * sure all pointers are stored as NaNs. */
-typedef union { double num; void* ptr; } naRef;
+ * sure all pointers are stored as NaNs.  32 bit layouts (and 64 bit
+ * platforms where we haven't tested the trick above) need
+ * endianness-dependent ordering to make sure that the reftag lies in
+ * the top bits of the double */
 
-#elif defined(NASAL_LE) || defined(NASAL_BE)
-
-/* 32 bit layouts (and 64 bit platforms where we haven't tested the
-   trick above) need endianness-dependent ordering to make sure that
-   the reftag lies in the top bits of the double */
-#ifdef NASAL_LE
+#if defined(NASAL_LE)
 typedef struct { naPtr ptr; int reftag; } naRefPart;
-#else /* NASAL_BE */
+#elif defined(NASAL_BE)
 typedef struct { int reftag; naPtr ptr; } naRefPart;
 #endif
 
-typedef union {
-    double num;
-    naRefPart ref;
-} naRef;
-
+#if defined(NASAL_NAN64)
+typedef union { double num; void* ptr; } naRef;
+#else
+typedef union { double num; naRefPart ref; } naRef;
 #endif
 
 #endif // _NAREF_H