diff --git a/System/Endian.hs b/System/Endian.hs
--- a/System/Endian.hs
+++ b/System/Endian.hs
@@ -21,11 +21,9 @@
     , toBE64
     ) where
 
-import Foreign.Marshal.Alloc
-import Foreign.Storable
-import Foreign.Ptr
+#include "MachDeps.h"
+
 import Foreign.C.Types
-import System.IO.Unsafe (unsafePerformIO)
 import Data.Word
 
 -- | represent the CPU endianness
@@ -40,14 +38,11 @@
 
 -- | return the system endianness
 getSystemEndianness :: Endianness
-getSystemEndianness = unsafePerformIO $ alloca $ \p ->
-    poke p cst >> peek (castPtr p) >>= return . check
-    where cst :: Word32
-          cst = 0x01000000
-          check :: Word8 -> Endianness
-          check x
-              | x == 0x01 = BigEndian 
-              | otherwise = LittleEndian
+#ifdef WORDS_BIGENDIAN
+getSystemEndianness = BigEndian
+#else
+getSystemEndianness = LittleEndian
+#endif
 
 -- | Convert from a big endian 64 bit value to the cpu endianness
 fromBE64 :: Word64 -> Word64
diff --git a/cpu.cabal b/cpu.cabal
--- a/cpu.cabal
+++ b/cpu.cabal
@@ -1,5 +1,5 @@
 Name:                cpu
-Version:             0.1.0
+Version:             0.1.1
 Description:         
     Lowlevel cpu routines to get basic properties of the cpu platform, like endianness and architecture.
 License:             BSD3
