1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

New macro ROUND8P() which works like ROUND8() but assumes that the input is

already a multiple of the size of a pointer.  It becomes a no-op for
64-bit machines, giving a small size reduction and speed boost.

FossilOrigin-Name: d126f304cde66ebfe21a4967c22dcba0bac27cbce56318b14bd50051e49c978c
This commit is contained in:
drh
2022-04-01 18:45:11 +00:00
parent 473571b083
commit cf6e3fd787
6 changed files with 29 additions and 18 deletions

View File

@@ -939,8 +939,19 @@ typedef INT16_TYPE LogEst;
/*
** Round up a number to the next larger multiple of 8. This is used
** to force 8-byte alignment on 64-bit architectures.
**
** ROUND8() always does the rounding, for any argument.
**
** ROUND8P() assumes that the argument is already an integer number of
** pointers in size, and so it is a no-op on systems where the pointer
** size is 8.
*/
#define ROUND8(x) (((x)+7)&~7)
#if SQLITE_PTRSIZE==8
# define ROUND8P(x) (x)
#else
# define ROUND8P(x) (((x)+7)&~7)
#endif
/*
** Round down to the nearest multiple of 8