Skip to content

Instantly share code, notes, and snippets.

@kangaroo
Created July 14, 2015 19:24
Show Gist options
  • Save kangaroo/2d862a3d8f9ce31bdc7a to your computer and use it in GitHub Desktop.
Save kangaroo/2d862a3d8f9ce31bdc7a to your computer and use it in GitHub Desktop.
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index 08d2a51..a53f0f8 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -764,11 +764,27 @@ inline
inline
float getR4LittleEndian(const BYTE * ptr)
-{ return *(UNALIGNED float*)ptr; }
+{
+#if FEATURE_UNALIGNED_FLOAT_ACCESS
+ return *(UNALIGNED float*)ptr;
+#else
+ float val;
+ memcpy(val, ptr, sizeof(float));
+ return val;
+#endif
+}
inline
double getR8LittleEndian(const BYTE * ptr)
-{ return *(UNALIGNED double*)ptr; }
+{
+#if FEATURE_UNALIGNED_FLOAT_ACCESS
+ return *(UNALIGNED double*)ptr;
+#else
+ double val;
+ memcpy (&val, ptr, sizeof(double));
+ return val;
+#endif
+}
/*****************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment