diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbemem.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vdbemem.c b/src/vdbemem.c index e806db363..ef6ed8f9d 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -418,11 +418,14 @@ void sqlite3VdbeIntegerAffinity(Mem *pMem){ ** (2) The integer is neither the largest nor the smallest ** possible integer (ticket #3922) ** - ** The second term in the following conditional enforces the second - ** condition under the assumption that addition overflow causes - ** values to wrap around. + ** The second and third terms in the following conditional enforces + ** the second condition under the assumption that addition overflow causes + ** values to wrap around. On x86 hardware, the third term is always + ** true and could be omitted. But we leave it in because other + ** architectures might behave differently. */ - if( pMem->r==(double)pMem->u.i && (pMem->u.i-1) < (pMem->u.i+1) ){ + if( pMem->r==(double)pMem->u.i && pMem->u.i>SMALLEST_INT64 + && ALWAYS(pMem->u.i<LARGEST_INT64) ){ pMem->flags |= MEM_Int; } } |