# WORDS\_BIGENDIAN on Mac OS X

**URL:** <https://www.ruby-forum.com/t/words-bigendian-on-mac-os-x/118388>\
**Category:** Development\
**Created:** [October 26, 2007, 1:03pm UTC](https://www.ruby-forum.com/t/words-bigendian-on-mac-os-x/118388 "2007-10-26T13:03:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Satoshi\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@Satoshi\_N](https://www.ruby-forum.com/u/Satoshi_N)\
**Post date:** [October 26, 2007, 1:03pm UTC](https://www.ruby-forum.com/t/words-bigendian-on-mac-os-x/118388/1 "2007-10-26T13:03:07Z")

</div>

e$BCf@n$H$$$$$^$9!#e(B

ruby-core:12895 e$B$Ge(B Laurent e$B$,e(B ruby 1.8 e$B$K$D$$$Fe(B

> words-bigendian-from-arch.diff: This patch moves some code that was  
> only effective for NeXT systems, for both Mac OS X and NeXT.  
> WORDS\_BIGENDIAN isn’t trusted from configure, but instead we use  
> **BIG\_ENDIAN**. This is to make sure you can build Ruby for both ppc  
> and i386 architectures (as a fat binary) on ppc, then use the binary  
> on i386 without getting endianness problems.

e$B$H=q$$$F$$$^$9$,!"$3$l$Oe(B trunk e$B$K$b$"$F$O$^$j$^$9!#e(B

ruby-dev:31626 e$B$Ne(B strtod e$B$N7o0JMh!"5$$K$J$C$F$$$?$N$G$9$,!"e(B  
Intel Mac e$B$Ge(B -arch i386 -arch ppc e$B$r;XDj$7$Fe(B make  
e$B$7$F$\_$k$He(B  
WORDS\_BIGENDIAN e$B$Oe(B i386 e$B$He(B ppc e$B$N%P%$%J%j$N$I$A$i$G$be(B  
define e$B$5$l$F$$$J$$$3$H$r3NG’$7$^$7$?!#e(B

e$B$7$?$,$C$F!"e(BWORDS\_BIGENDIAN e$B$rMxMQ$7$F$$$kItJ,$O!"e(B  
fat binary e$B$G$O$A$c$s$HF0:n$7$F$$$J$$$O$:$@$H;W$$$^$9!#e(B

# Index: include/ruby/defines.h

— include/ruby/defines.h (revision 13787)  
+++ include/ruby/defines.h (working copy)  
@@ -106,6 +106,16 @@  
#endif  
#endif  
+#if defined( **NeXT** ) || defined( **APPLE** )  
+/\* Do not trust WORDS\_BIGENDIAN from configure since -arch compiler  
flag may

- result in a different endian. Instead trust **BIG\_ENDIAN** and
- **LITTLE\_ENDIAN** which are set correctly by -arch. \*/  
+#undef WORDS\_BIGENDIAN  
+#ifdef **BIG\_ENDIAN**  
+#define WORDS\_BIGENDIAN  
+#endif  
+#endif
- 

#ifdef **NeXT**  
/\* NextStep, OpenStep, Rhapsody _/  
 #ifndef S\_IRUSR  
@@ -159,13 +169,6 @@  
 #ifndef S\_ISREG  
 #define S\_ISREG(mode) (((mode) & (0170000)) == (0100000))  
 #endif  
-/_ Do not trust WORDS\_BIGENDIAN from configure since -arch compiler  
flag may

- result in a different endian. Instead trust **BIG\_ENDIAN** and
- **LITTLE\_ENDIAN** which are set correctly by -arch. _/  
-#undef WORDS\_BIGENDIAN  
-#ifdef **BIG\_ENDIAN**  
-#define WORDS\_BIGENDIAN  
-#endif  
 #ifndef **APPLE**  
/_ NextStep, OpenStep (but not Rhapsody) \*/  
#ifndef GETPGRP\_VOID
