Fossil SCM

Cherrypick [http://www.sqlite.org/src/info/810d29320b853b3a|810d29320b]: Remove the CLANG_VERSION macro, since we have learned that version numbers in clang are "marketing" and are inconsistent and unreliable. Builds using clang will still use the GCC_VERSION macro since clang works hard to be gcc compatible.

jan.nijtmans 2017-02-17 13:23 branch-1.37
Commit c453a916069a84e8da1aad2a6480349befd47ac7
1 file changed +23 -28
+23 -28
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,27 +202,28 @@
202202
# define _FILE_OFFSET_BITS 64
203203
# endif
204204
# define _LARGEFILE_SOURCE 1
205205
#endif
206206
207
-/* The GCC_VERSION, CLANG_VERSION, and MSVC_VERSION macros are used to
207
+/* The GCC_VERSION and MSVC_VERSION macros are used to
208208
** conditionally include optimizations for each of these compilers. A
209209
** value of 0 means that compiler is not being used. The
210210
** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
211211
** optimizations, and hence set all compiler macros to 0
212
+**
213
+** There was once also a CLANG_VERSION macro. However, we learn that the
214
+** version numbers in clang are for "marketing" only and are inconsistent
215
+** and unreliable. Fortunately, all versions of clang also recognize the
216
+** gcc version numbers and have reasonable settings for gcc version numbers,
217
+** so the GCC_VERSION macro will be set to a correct non-zero value even
218
+** when compiling with clang.
212219
*/
213220
#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
214221
# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
215222
#else
216223
# define GCC_VERSION 0
217224
#endif
218
-#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
219
-# define CLANG_VERSION \
220
- (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
221
-#else
222
-# define CLANG_VERSION 0
223
-#endif
224225
#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
225226
# define MSVC_VERSION _MSC_VER
226227
#else
227228
# define MSVC_VERSION 0
228229
#endif
@@ -28695,11 +28696,11 @@
2869528696
SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
2869628697
#if SQLITE_BYTEORDER==4321
2869728698
u32 x;
2869828699
memcpy(&x,p,4);
2869928700
return x;
28700
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28701
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
2870128702
u32 x;
2870228703
memcpy(&x,p,4);
2870328704
return __builtin_bswap32(x);
2870428705
#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
2870528706
u32 x;
@@ -28711,11 +28712,11 @@
2871128712
#endif
2871228713
}
2871328714
SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
2871428715
#if SQLITE_BYTEORDER==4321
2871528716
memcpy(p,&v,4);
28716
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28717
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
2871728718
u32 x = __builtin_bswap32(v);
2871828719
memcpy(p,&x,4);
2871928720
#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
2872028721
u32 x = _byteswap_ulong(v);
2872128722
memcpy(p,&x,4);
@@ -28830,11 +28831,11 @@
2883028831
** the other 64-bit signed integer at *pA and store the result in *pA.
2883128832
** Return 0 on success. Or if the operation would have resulted in an
2883228833
** overflow, leave *pA unchanged and return 1.
2883328834
*/
2883428835
SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28835
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28836
+#if GCC_VERSION>=5004000
2883628837
return __builtin_add_overflow(*pA, iB, pA);
2883728838
#else
2883828839
i64 iA = *pA;
2883928840
testcase( iA==0 ); testcase( iA==1 );
2884028841
testcase( iB==-1 ); testcase( iB==0 );
@@ -28850,11 +28851,11 @@
2885028851
*pA += iB;
2885128852
return 0;
2885228853
#endif
2885328854
}
2885428855
SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28855
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28856
+#if GCC_VERSION>=5004000
2885628857
return __builtin_sub_overflow(*pA, iB, pA);
2885728858
#else
2885828859
testcase( iB==SMALLEST_INT64+1 );
2885928860
if( iB==SMALLEST_INT64 ){
2886028861
testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28865,11 +28866,11 @@
2886528866
return sqlite3AddInt64(pA, -iB);
2886628867
}
2886728868
#endif
2886828869
}
2886928870
SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28870
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28871
+#if GCC_VERSION>=5004000
2887128872
return __builtin_mul_overflow(*pA, iB, pA);
2887228873
#else
2887328874
i64 iA = *pA;
2887428875
if( iB>0 ){
2887528876
if( iA>LARGEST_INT64/iB ) return 1;
@@ -163302,27 +163303,21 @@
163302163303
#endif
163303163304
#ifndef MIN
163304163305
# define MIN(x,y) ((x) > (y) ? (y) : (x))
163305163306
#endif
163306163307
163307
-/* What version of GCC is being used. 0 means GCC is not being used */
163308
+/* What version of GCC is being used. 0 means GCC is not being used .
163309
+** Note that the GCC_VERSION macro will also be set correctly when using
163310
+** clang, since clang works hard to be gcc compatible. So the gcc
163311
+** optimizations will also work when compiling with clang.
163312
+*/
163308163313
#ifndef GCC_VERSION
163309163314
#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
163310163315
# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163311163316
#else
163312163317
# define GCC_VERSION 0
163313163318
#endif
163314
-#endif
163315
-
163316
-/* What version of CLANG is being used. 0 means CLANG is not being used */
163317
-#ifndef CLANG_VERSION
163318
-#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
163319
-# define CLANG_VERSION \
163320
- (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
163321
-#else
163322
-# define CLANG_VERSION 0
163323
-#endif
163324163319
#endif
163325163320
163326163321
/* The testcase() macro should already be defined in the amalgamation. If
163327163322
** it is not, make it a no-op.
163328163323
*/
@@ -163371,11 +163366,11 @@
163371163366
}
163372163367
static void readCoord(u8 *p, RtreeCoord *pCoord){
163373163368
assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163374163369
#if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163375163370
pCoord->u = _byteswap_ulong(*(u32*)p);
163376
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163371
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163377163372
pCoord->u = __builtin_bswap32(*(u32*)p);
163378163373
#elif SQLITE_BYTEORDER==4321
163379163374
pCoord->u = *(u32*)p;
163380163375
#else
163381163376
pCoord->u = (
@@ -163389,11 +163384,11 @@
163389163384
static i64 readInt64(u8 *p){
163390163385
#if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163391163386
u64 x;
163392163387
memcpy(&x, p, 8);
163393163388
return (i64)_byteswap_uint64(x);
163394
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163389
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163395163390
u64 x;
163396163391
memcpy(&x, p, 8);
163397163392
return (i64)__builtin_bswap64(x);
163398163393
#elif SQLITE_BYTEORDER==4321
163399163394
i64 x;
@@ -163425,11 +163420,11 @@
163425163420
static int writeCoord(u8 *p, RtreeCoord *pCoord){
163426163421
u32 i;
163427163422
assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163428163423
assert( sizeof(RtreeCoord)==4 );
163429163424
assert( sizeof(u32)==4 );
163430
-#if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163425
+#if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163431163426
i = __builtin_bswap32(pCoord->u);
163432163427
memcpy(p, &i, 4);
163433163428
#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163434163429
i = _byteswap_ulong(pCoord->u);
163435163430
memcpy(p, &i, 4);
@@ -163444,11 +163439,11 @@
163444163439
p[3] = (i>> 0)&0xFF;
163445163440
#endif
163446163441
return 4;
163447163442
}
163448163443
static int writeInt64(u8 *p, i64 i){
163449
-#if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163444
+#if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163450163445
i = (i64)__builtin_bswap64((u64)i);
163451163446
memcpy(p, &i, 8);
163452163447
#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163453163448
i = (i64)_byteswap_uint64((u64)i);
163454163449
memcpy(p, &i, 8);
@@ -164000,11 +163995,11 @@
164000163995
#define RTREE_DECODE_COORD(eInt, a, r) { \
164001163996
RtreeCoord c; /* Coordinate decoded */ \
164002163997
c.u = _byteswap_ulong(*(u32*)a); \
164003163998
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
164004163999
}
164005
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
164000
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
164006164001
#define RTREE_DECODE_COORD(eInt, a, r) { \
164007164002
RtreeCoord c; /* Coordinate decoded */ \
164008164003
c.u = __builtin_bswap32(*(u32*)a); \
164009164004
r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
164010164005
}
164011164006
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,27 +202,28 @@
202 # define _FILE_OFFSET_BITS 64
203 # endif
204 # define _LARGEFILE_SOURCE 1
205 #endif
206
207 /* The GCC_VERSION, CLANG_VERSION, and MSVC_VERSION macros are used to
208 ** conditionally include optimizations for each of these compilers. A
209 ** value of 0 means that compiler is not being used. The
210 ** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
211 ** optimizations, and hence set all compiler macros to 0
 
 
 
 
 
 
 
212 */
213 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
214 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
215 #else
216 # define GCC_VERSION 0
217 #endif
218 #if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
219 # define CLANG_VERSION \
220 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
221 #else
222 # define CLANG_VERSION 0
223 #endif
224 #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
225 # define MSVC_VERSION _MSC_VER
226 #else
227 # define MSVC_VERSION 0
228 #endif
@@ -28695,11 +28696,11 @@
28695 SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
28696 #if SQLITE_BYTEORDER==4321
28697 u32 x;
28698 memcpy(&x,p,4);
28699 return x;
28700 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28701 u32 x;
28702 memcpy(&x,p,4);
28703 return __builtin_bswap32(x);
28704 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
28705 u32 x;
@@ -28711,11 +28712,11 @@
28711 #endif
28712 }
28713 SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
28714 #if SQLITE_BYTEORDER==4321
28715 memcpy(p,&v,4);
28716 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28717 u32 x = __builtin_bswap32(v);
28718 memcpy(p,&x,4);
28719 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
28720 u32 x = _byteswap_ulong(v);
28721 memcpy(p,&x,4);
@@ -28830,11 +28831,11 @@
28830 ** the other 64-bit signed integer at *pA and store the result in *pA.
28831 ** Return 0 on success. Or if the operation would have resulted in an
28832 ** overflow, leave *pA unchanged and return 1.
28833 */
28834 SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28835 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28836 return __builtin_add_overflow(*pA, iB, pA);
28837 #else
28838 i64 iA = *pA;
28839 testcase( iA==0 ); testcase( iA==1 );
28840 testcase( iB==-1 ); testcase( iB==0 );
@@ -28850,11 +28851,11 @@
28850 *pA += iB;
28851 return 0;
28852 #endif
28853 }
28854 SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28855 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28856 return __builtin_sub_overflow(*pA, iB, pA);
28857 #else
28858 testcase( iB==SMALLEST_INT64+1 );
28859 if( iB==SMALLEST_INT64 ){
28860 testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28865,11 +28866,11 @@
28865 return sqlite3AddInt64(pA, -iB);
28866 }
28867 #endif
28868 }
28869 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28870 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
28871 return __builtin_mul_overflow(*pA, iB, pA);
28872 #else
28873 i64 iA = *pA;
28874 if( iB>0 ){
28875 if( iA>LARGEST_INT64/iB ) return 1;
@@ -163302,27 +163303,21 @@
163302 #endif
163303 #ifndef MIN
163304 # define MIN(x,y) ((x) > (y) ? (y) : (x))
163305 #endif
163306
163307 /* What version of GCC is being used. 0 means GCC is not being used */
 
 
 
 
163308 #ifndef GCC_VERSION
163309 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
163310 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163311 #else
163312 # define GCC_VERSION 0
163313 #endif
163314 #endif
163315
163316 /* What version of CLANG is being used. 0 means CLANG is not being used */
163317 #ifndef CLANG_VERSION
163318 #if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
163319 # define CLANG_VERSION \
163320 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
163321 #else
163322 # define CLANG_VERSION 0
163323 #endif
163324 #endif
163325
163326 /* The testcase() macro should already be defined in the amalgamation. If
163327 ** it is not, make it a no-op.
163328 */
@@ -163371,11 +163366,11 @@
163371 }
163372 static void readCoord(u8 *p, RtreeCoord *pCoord){
163373 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163374 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163375 pCoord->u = _byteswap_ulong(*(u32*)p);
163376 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163377 pCoord->u = __builtin_bswap32(*(u32*)p);
163378 #elif SQLITE_BYTEORDER==4321
163379 pCoord->u = *(u32*)p;
163380 #else
163381 pCoord->u = (
@@ -163389,11 +163384,11 @@
163389 static i64 readInt64(u8 *p){
163390 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163391 u64 x;
163392 memcpy(&x, p, 8);
163393 return (i64)_byteswap_uint64(x);
163394 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163395 u64 x;
163396 memcpy(&x, p, 8);
163397 return (i64)__builtin_bswap64(x);
163398 #elif SQLITE_BYTEORDER==4321
163399 i64 x;
@@ -163425,11 +163420,11 @@
163425 static int writeCoord(u8 *p, RtreeCoord *pCoord){
163426 u32 i;
163427 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163428 assert( sizeof(RtreeCoord)==4 );
163429 assert( sizeof(u32)==4 );
163430 #if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163431 i = __builtin_bswap32(pCoord->u);
163432 memcpy(p, &i, 4);
163433 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163434 i = _byteswap_ulong(pCoord->u);
163435 memcpy(p, &i, 4);
@@ -163444,11 +163439,11 @@
163444 p[3] = (i>> 0)&0xFF;
163445 #endif
163446 return 4;
163447 }
163448 static int writeInt64(u8 *p, i64 i){
163449 #if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163450 i = (i64)__builtin_bswap64((u64)i);
163451 memcpy(p, &i, 8);
163452 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163453 i = (i64)_byteswap_uint64((u64)i);
163454 memcpy(p, &i, 8);
@@ -164000,11 +163995,11 @@
164000 #define RTREE_DECODE_COORD(eInt, a, r) { \
164001 RtreeCoord c; /* Coordinate decoded */ \
164002 c.u = _byteswap_ulong(*(u32*)a); \
164003 r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
164004 }
164005 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
164006 #define RTREE_DECODE_COORD(eInt, a, r) { \
164007 RtreeCoord c; /* Coordinate decoded */ \
164008 c.u = __builtin_bswap32(*(u32*)a); \
164009 r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
164010 }
164011
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,27 +202,28 @@
202 # define _FILE_OFFSET_BITS 64
203 # endif
204 # define _LARGEFILE_SOURCE 1
205 #endif
206
207 /* The GCC_VERSION and MSVC_VERSION macros are used to
208 ** conditionally include optimizations for each of these compilers. A
209 ** value of 0 means that compiler is not being used. The
210 ** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
211 ** optimizations, and hence set all compiler macros to 0
212 **
213 ** There was once also a CLANG_VERSION macro. However, we learn that the
214 ** version numbers in clang are for "marketing" only and are inconsistent
215 ** and unreliable. Fortunately, all versions of clang also recognize the
216 ** gcc version numbers and have reasonable settings for gcc version numbers,
217 ** so the GCC_VERSION macro will be set to a correct non-zero value even
218 ** when compiling with clang.
219 */
220 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
221 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
222 #else
223 # define GCC_VERSION 0
224 #endif
 
 
 
 
 
 
225 #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
226 # define MSVC_VERSION _MSC_VER
227 #else
228 # define MSVC_VERSION 0
229 #endif
@@ -28695,11 +28696,11 @@
28696 SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
28697 #if SQLITE_BYTEORDER==4321
28698 u32 x;
28699 memcpy(&x,p,4);
28700 return x;
28701 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
28702 u32 x;
28703 memcpy(&x,p,4);
28704 return __builtin_bswap32(x);
28705 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
28706 u32 x;
@@ -28711,11 +28712,11 @@
28712 #endif
28713 }
28714 SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
28715 #if SQLITE_BYTEORDER==4321
28716 memcpy(p,&v,4);
28717 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
28718 u32 x = __builtin_bswap32(v);
28719 memcpy(p,&x,4);
28720 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
28721 u32 x = _byteswap_ulong(v);
28722 memcpy(p,&x,4);
@@ -28830,11 +28831,11 @@
28831 ** the other 64-bit signed integer at *pA and store the result in *pA.
28832 ** Return 0 on success. Or if the operation would have resulted in an
28833 ** overflow, leave *pA unchanged and return 1.
28834 */
28835 SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28836 #if GCC_VERSION>=5004000
28837 return __builtin_add_overflow(*pA, iB, pA);
28838 #else
28839 i64 iA = *pA;
28840 testcase( iA==0 ); testcase( iA==1 );
28841 testcase( iB==-1 ); testcase( iB==0 );
@@ -28850,11 +28851,11 @@
28851 *pA += iB;
28852 return 0;
28853 #endif
28854 }
28855 SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28856 #if GCC_VERSION>=5004000
28857 return __builtin_sub_overflow(*pA, iB, pA);
28858 #else
28859 testcase( iB==SMALLEST_INT64+1 );
28860 if( iB==SMALLEST_INT64 ){
28861 testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28865,11 +28866,11 @@
28866 return sqlite3AddInt64(pA, -iB);
28867 }
28868 #endif
28869 }
28870 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28871 #if GCC_VERSION>=5004000
28872 return __builtin_mul_overflow(*pA, iB, pA);
28873 #else
28874 i64 iA = *pA;
28875 if( iB>0 ){
28876 if( iA>LARGEST_INT64/iB ) return 1;
@@ -163302,27 +163303,21 @@
163303 #endif
163304 #ifndef MIN
163305 # define MIN(x,y) ((x) > (y) ? (y) : (x))
163306 #endif
163307
163308 /* What version of GCC is being used. 0 means GCC is not being used .
163309 ** Note that the GCC_VERSION macro will also be set correctly when using
163310 ** clang, since clang works hard to be gcc compatible. So the gcc
163311 ** optimizations will also work when compiling with clang.
163312 */
163313 #ifndef GCC_VERSION
163314 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
163315 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163316 #else
163317 # define GCC_VERSION 0
163318 #endif
 
 
 
 
 
 
 
 
 
 
163319 #endif
163320
163321 /* The testcase() macro should already be defined in the amalgamation. If
163322 ** it is not, make it a no-op.
163323 */
@@ -163371,11 +163366,11 @@
163366 }
163367 static void readCoord(u8 *p, RtreeCoord *pCoord){
163368 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163369 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163370 pCoord->u = _byteswap_ulong(*(u32*)p);
163371 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163372 pCoord->u = __builtin_bswap32(*(u32*)p);
163373 #elif SQLITE_BYTEORDER==4321
163374 pCoord->u = *(u32*)p;
163375 #else
163376 pCoord->u = (
@@ -163389,11 +163384,11 @@
163384 static i64 readInt64(u8 *p){
163385 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163386 u64 x;
163387 memcpy(&x, p, 8);
163388 return (i64)_byteswap_uint64(x);
163389 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163390 u64 x;
163391 memcpy(&x, p, 8);
163392 return (i64)__builtin_bswap64(x);
163393 #elif SQLITE_BYTEORDER==4321
163394 i64 x;
@@ -163425,11 +163420,11 @@
163420 static int writeCoord(u8 *p, RtreeCoord *pCoord){
163421 u32 i;
163422 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163423 assert( sizeof(RtreeCoord)==4 );
163424 assert( sizeof(u32)==4 );
163425 #if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163426 i = __builtin_bswap32(pCoord->u);
163427 memcpy(p, &i, 4);
163428 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163429 i = _byteswap_ulong(pCoord->u);
163430 memcpy(p, &i, 4);
@@ -163444,11 +163439,11 @@
163439 p[3] = (i>> 0)&0xFF;
163440 #endif
163441 return 4;
163442 }
163443 static int writeInt64(u8 *p, i64 i){
163444 #if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
163445 i = (i64)__builtin_bswap64((u64)i);
163446 memcpy(p, &i, 8);
163447 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163448 i = (i64)_byteswap_uint64((u64)i);
163449 memcpy(p, &i, 8);
@@ -164000,11 +163995,11 @@
163995 #define RTREE_DECODE_COORD(eInt, a, r) { \
163996 RtreeCoord c; /* Coordinate decoded */ \
163997 c.u = _byteswap_ulong(*(u32*)a); \
163998 r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
163999 }
164000 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
164001 #define RTREE_DECODE_COORD(eInt, a, r) { \
164002 RtreeCoord c; /* Coordinate decoded */ \
164003 c.u = __builtin_bswap32(*(u32*)a); \
164004 r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
164005 }
164006

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button