mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Remove the use of htonl() in the previous check-in due to linkage issues.
Add the get2byteAligned() macro and use it for access to the cell offsets on btree pages for about a 1% performance gain. FossilOrigin-Name: 79ff36b7170c9e7e7a9935c8b9d1665867771087
This commit is contained in:
@@ -691,3 +691,16 @@ struct IntegrityCk {
|
||||
#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v))
|
||||
#define get4byte sqlite3Get4byte
|
||||
#define put4byte sqlite3Put4byte
|
||||
|
||||
/*
|
||||
** get2byteAligned(), unlike get2byte(), requires that its argument point to a
|
||||
** two-byte aligned address. get2bytea() is only used for accessing the
|
||||
** cell addresses in a btree header.
|
||||
*/
|
||||
#if SQLITE_BYTEORDER==4321
|
||||
# define get2byteAligned(x) (*(u16*)(x))
|
||||
#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__)
|
||||
# define get2byteAligned(x) __builtin_bswap16(*(u16*)(x))
|
||||
#else
|
||||
# define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user