1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix C99-style variable declaration issue seen with older versions of MSVC.

FossilOrigin-Name: 54d285464a222c59327eb6c917c1cc0125a55a27
This commit is contained in:
mistachkin
2017-02-01 22:59:29 +00:00
parent 8c5e8feb35
commit 2fa517bf2a
3 changed files with 11 additions and 8 deletions

View File

@ -450,20 +450,23 @@ static void readCoord(u8 *p, RtreeCoord *pCoord){
#endif
}
static i64 readInt64(u8 *p){
testcase( ((((char*)p) - (char*)0)&7)!=0 ); /* not always 8-byte aligned */
#if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
u64 x;
testcase( ((((char*)p) - (char*)0)&7)!=0 ); /* not always 8-byte aligned */
memcpy(&x, p, 8);
return (i64)_byteswap_uint64(x);
#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
u64 x;
testcase( ((((char*)p) - (char*)0)&7)!=0 ); /* not always 8-byte aligned */
memcpy(&x, p, 8);
return (i64)__builtin_bswap64(x);
#elif SQLITE_BYTEORDER==4321
i64 x;
testcase( ((((char*)p) - (char*)0)&7)!=0 ); /* not always 8-byte aligned */
memcpy(&x, p, 8);
return x;
#else
testcase( ((((char*)p) - (char*)0)&7)!=0 ); /* not always 8-byte aligned */
return (
(((i64)p[0]) << 56) +
(((i64)p[1]) << 48) +