mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-06 15:49:35 +03:00
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
This commit is contained in:
@@ -484,9 +484,19 @@ extern const int sqlite3one;
|
||||
#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
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user