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

Reformulate the constants for the minimum and maximum 64-bit signed

integer to work better with some compilers.  Ticket #3105. (CVS 5113)

FossilOrigin-Name: 18b1ee10b89bd0a98d1986dbb04b9d6cfc3dad39
This commit is contained in:
drh
2008-05-09 18:03:13 +00:00
parent 93f7af97a6
commit 0f050353e9
5 changed files with 24 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\sproblem\swith\srecovering\sfrom\san\sIO\serror\sin\sexclusive-locking\smode.\s(CVS\s5112) C Reformulate\sthe\sconstants\sfor\sthe\sminimum\sand\smaximum\s64-bit\ssigned\ninteger\sto\swork\sbetter\swith\ssome\scompilers.\s\sTicket\s#3105.\s(CVS\s5113)
D 2008-05-09T16:57:51 D 2008-05-09T18:03:14
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739 F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -132,7 +132,7 @@ F src/select.c da43ce3080112aa77863e9c570c1df19a892acb8
F src/shell.c 668ad976716982eb658019eda489b6f55131dbe7 F src/shell.c 668ad976716982eb658019eda489b6f55131dbe7
F src/sqlite.h.in abb785d2afcf45bb9344fe6edc1c7b428e1b719f F src/sqlite.h.in abb785d2afcf45bb9344fe6edc1c7b428e1b719f
F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3 F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3
F src/sqliteInt.h 01d7bcebc1154c583e08533e5a734e79a2bf06f8 F src/sqliteInt.h c38fad42820bd3a68cdb185edbea9aff8bf5c18b
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/table.c 46ccf9b7892a86f57420ae7bac69ecd5e72d26b5 F src/table.c 46ccf9b7892a86f57420ae7bac69ecd5e72d26b5
F src/tclsqlite.c c57e740e30bd6dda678796eed62c7f0e64689834 F src/tclsqlite.c c57e740e30bd6dda678796eed62c7f0e64689834
@@ -167,14 +167,14 @@ F src/update.c 2d7143b9014e955509cc4f323f9a9584fb898f34
F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
F src/util.c 99e0f11500f5a11f4ec7c60b52f34bd0ff622cea F src/util.c 99e0f11500f5a11f4ec7c60b52f34bd0ff622cea
F src/vacuum.c c3b2b70677f874102b8753bf494c232e777f3998 F src/vacuum.c c3b2b70677f874102b8753bf494c232e777f3998
F src/vdbe.c 2bc3352c8109ef312ea129ae1cbad4c0328c5871 F src/vdbe.c 56c11eb1493296ef6da5bbc049e77b795824bdc7
F src/vdbe.h f4bb70962d9c13e0f65b215c90e8acea1ae6e8ee F src/vdbe.h f4bb70962d9c13e0f65b215c90e8acea1ae6e8ee
F src/vdbeInt.h 18aebaa7857de4507d92ced62d8fe0844671a681 F src/vdbeInt.h 18aebaa7857de4507d92ced62d8fe0844671a681
F src/vdbeapi.c 95ed14a59c509f98c64afba30cd18c3c8cf649cd F src/vdbeapi.c 95ed14a59c509f98c64afba30cd18c3c8cf649cd
F src/vdbeaux.c b98643abd85ae19318ee823f79168ae99b3a512e F src/vdbeaux.c b98643abd85ae19318ee823f79168ae99b3a512e
F src/vdbeblob.c 554736781ee273a8089c776e96bdb53e66f57ce6 F src/vdbeblob.c 554736781ee273a8089c776e96bdb53e66f57ce6
F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736 F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
F src/vdbemem.c 8cdc5d4c9558338a2c5ae81135d0826136833b5e F src/vdbemem.c 8397a763e8cc5932b16b19daee1f8094f15f9a7d
F src/vtab.c ce9d19ca9053812a557010fd4be7e842f8ebba2d F src/vtab.c ce9d19ca9053812a557010fd4be7e842f8ebba2d
F src/where.c 85719d58e0f680b5d8239dc6af82b159775d7376 F src/where.c 85719d58e0f680b5d8239dc6af82b159775d7376
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
@@ -634,7 +634,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 069f4560107246fdc31e1f15c3ad7d3dae2b9ad8 P 7a44fb965b3477fb78901939ba35d569e5638c19
R f45b51024a5e8c743be851676769c12e R 6cbdb6f56493d0a72650ba12a767bbfe
U danielk1977 U drh
Z 6411c1571b3ff8cf23c5c624d3f8d386 Z b0ab4136f4eb66dad3b479b35f66c468

View File

@@ -1 +1 @@
7a44fb965b3477fb78901939ba35d569e5638c19 18b1ee10b89bd0a98d1986dbb04b9d6cfc3dad39

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.702 2008/05/07 02:42:03 mlcreech Exp $ ** @(#) $Id: sqliteInt.h,v 1.703 2008/05/09 18:03:14 drh Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@@ -346,6 +346,14 @@ extern const int sqlite3one;
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE) # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
#endif #endif
/*
** Constants for the largest and smallest possible 64-bit signed integers.
** These macros are designed to work correctly on both 32-bit and 64-bit
** compilers.
*/
#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
/* /*
** An instance of the following structure is used to store the busy-handler ** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle. ** callback for a given sqlite handle.

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.738 2008/05/07 18:59:29 shane Exp $ ** $Id: vdbe.c,v 1.739 2008/05/09 18:03:14 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -1155,13 +1155,13 @@ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
case OP_Divide: { case OP_Divide: {
if( a==0 ) goto arithmetic_result_is_null; if( a==0 ) goto arithmetic_result_is_null;
/* Dividing the largest possible negative 64-bit integer (1<<63) by /* Dividing the largest possible negative 64-bit integer (1<<63) by
** -1 returns an integer to large to store in a 64-bit data-type. On ** -1 returns an integer too large to store in a 64-bit data-type. On
** some architectures, the value overflows to (1<<63). On others, ** some architectures, the value overflows to (1<<63). On others,
** a SIGFPE is issued. The following statement normalizes this ** a SIGFPE is issued. The following statement normalizes this
** behaviour so that all architectures behave as if integer ** behaviour so that all architectures behave as if integer
** overflow occured. ** overflow occured.
*/ */
if( a==-1 && b==(((i64)1)<<63) ) a = 1; if( a==-1 && b==SMALLEST_INT64 ) a = 1;
b /= a; b /= a;
break; break;
} }

View File

@@ -310,8 +310,8 @@ static i64 doubleToInt64(double r){
** So we define our own static constants here using nothing ** So we define our own static constants here using nothing
** larger than a 32-bit integer constant. ** larger than a 32-bit integer constant.
*/ */
static const i64 maxInt = (((i64)0x7fffffff)<<32)|0xffffffff; static const i64 maxInt = LARGEST_INT64;
static const i64 minInt = ((i64)0x80000000)<<32; static const i64 minInt = SMALLEST_INT64;
if( r<(double)minInt ){ if( r<(double)minInt ){
return minInt; return minInt;