Add the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option which tells some
assert() statements that the underlying system only requires 4-byte alignment
of 8-byte data objects like double or int64 and that system malloc() only
guarantees 4-byte alignment of returned pointers.
FossilOrigin-Name: 08faee686eb2fabe0dde51231ee55880e78541e8
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index aae1c3c..1202971 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -484,9 +484,19 @@
#define ROUNDDOWN8(x) ((x)&~7)
/*
-** Assert that the pointer X is aligned to an 8-byte boundary.
+** Assert that the pointer X is aligned to an 8-byte boundary. This
+** macro is used only within assert() to verify that the code gets
+** all alignment restrictions correct.
+**
+** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the
+** underlying malloc() implemention might return us 4-byte aligned
+** pointers. In that case, only verify 4-byte alignment.
*/
-#define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
+#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
+# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0)
+#else
+# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
+#endif
/*