info-inventor-dev
[Top] [All Lists]

[patch] use glibc's <endian.h>

To: info-inventor-dev@xxxxxxxxxxx
Subject: [patch] use glibc's <endian.h>
From: "Steve M. Robbins" <steven.robbins@xxxxxxxxxxxx>
Date: Tue, 19 Feb 2002 14:20:38 -0500
Sender: owner-info-inventor-dev@xxxxxxxxxxx
User-agent: Mutt/1.3.27i
Hi,

I maintain OpenInventor for Debian.  We build on a large number
of different CPUs.  Rather than add a bunch more "#if __cpu__"
stanzas to the inventor header "machine.h", I patched it to
use the GNU libc header <endian.h> as a fall-back.

Regards,
-Steve


Index: lib/database/include/machine.h
===================================================================
RCS file: /home/steve/lib/cvs/debian/inventor/lib/database/include/machine.h,v
retrieving revision 1.1.1.2
diff -u -b -B -r1.1.1.2 machine.h
--- lib/database/include/machine.h      25 Sep 2001 00:45:32 -0000      1.1.1.2
+++ lib/database/include/machine.h      19 Feb 2002 19:11:41 -0000
@@ -164,6 +164,28 @@
 #endif
 
 
+/* Added for Debian by Steve M. Robbins */
+#if !defined(MACHINE_WORD_FORMAT)
+#   include <endian.h>
+
+#   if __BYTE_ORDER == __BIG_ENDIAN
+#       define MACHINE_WORD_FORMAT     DGL_BIG_ENDIAN
+#   elif __BYTE_ORDER == __LITTLE_ENDIAN
+#       define MACHINE_WORD_FORMAT      DGL_LITTLE_ENDIAN
+#   else
+#       error Inventor needs to be set up for your CPU type.
+#   endif
+
+#   if __FLOAT_WORD_ORDER == __BIG_ENDIAN
+#       define MACHINE_FLOAT_FORMAT    DGL_BIG_IEEE
+#   else
+#       define MACHINE_FLOAT_FORMAT     DGL_NON_IEEE
+#   endif
+
+#endif
+
+
+
 
 /*
  * 32/64-bit architecture dependent statements
@@ -309,12 +331,10 @@
  */
 
 #if MACHINE_FLOAT_FORMAT == DGL_NON_IEEE
-#if __i386__ || __ia64__
 void mem_hton_float(float *t, float *f);
 void mem_ntoh_float(float *t, float *f);
 void mem_hton_double(double *t, double *f);
 void mem_ntoh_double(double *t, double *f);
-#endif /* __i386__ || __ia64__ */
 #define DGL_HTON_FLOAT(t,f) mem_hton_float(&t,&f)
 #define DGL_NTOH_FLOAT(t,f) mem_ntoh_float(&t,&f)
 #define DGL_HTON_DOUBLE(t,f) mem_hton_double(&t,&f)




-- 
by Rocket to the Moon,
by Airplane to the Rocket,
by Taxi to the Airport,
by Frontdoor to the Taxi,
by throwing back the blanket and laying down the legs ...
- They Might Be Giants


<Prev in Thread] Current Thread [Next in Thread>
  • [patch] use glibc's <endian.h>, Steve M. Robbins <=