]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Reformulate the constants for the minimum and maximum 64-bit signed
authordrh <drh@noemail.net>
Fri, 9 May 2008 18:03:13 +0000 (18:03 +0000)
committerdrh <drh@noemail.net>
Fri, 9 May 2008 18:03:13 +0000 (18:03 +0000)
integer to work better with some compilers.  Ticket #3105. (CVS 5113)

FossilOrigin-Name: 18b1ee10b89bd0a98d1986dbb04b9d6cfc3dad39

manifest
manifest.uuid
src/sqliteInt.h
src/vdbe.c
src/vdbemem.c

index 4dd4e527d257c0d55aa6c0785c90604eab7ab395..8a11c02fb6e96d2453cc270d221e883bb28c3922 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\swith\srecovering\sfrom\san\sIO\serror\sin\sexclusive-locking\smode.\s(CVS\s5112)
-D 2008-05-09T16:57:51
+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-09T18:03:14
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -132,7 +132,7 @@ F src/select.c da43ce3080112aa77863e9c570c1df19a892acb8
 F src/shell.c 668ad976716982eb658019eda489b6f55131dbe7
 F src/sqlite.h.in abb785d2afcf45bb9344fe6edc1c7b428e1b719f
 F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3
-F src/sqliteInt.h 01d7bcebc1154c583e08533e5a734e79a2bf06f8
+F src/sqliteInt.h c38fad42820bd3a68cdb185edbea9aff8bf5c18b
 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
 F src/table.c 46ccf9b7892a86f57420ae7bac69ecd5e72d26b5
 F src/tclsqlite.c c57e740e30bd6dda678796eed62c7f0e64689834
@@ -167,14 +167,14 @@ F src/update.c 2d7143b9014e955509cc4f323f9a9584fb898f34
 F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
 F src/util.c 99e0f11500f5a11f4ec7c60b52f34bd0ff622cea
 F src/vacuum.c c3b2b70677f874102b8753bf494c232e777f3998
-F src/vdbe.c 2bc3352c8109ef312ea129ae1cbad4c0328c5871
+F src/vdbe.c 56c11eb1493296ef6da5bbc049e77b795824bdc7
 F src/vdbe.h f4bb70962d9c13e0f65b215c90e8acea1ae6e8ee
 F src/vdbeInt.h 18aebaa7857de4507d92ced62d8fe0844671a681
 F src/vdbeapi.c 95ed14a59c509f98c64afba30cd18c3c8cf649cd
 F src/vdbeaux.c b98643abd85ae19318ee823f79168ae99b3a512e
 F src/vdbeblob.c 554736781ee273a8089c776e96bdb53e66f57ce6
 F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
-F src/vdbemem.c 8cdc5d4c9558338a2c5ae81135d0826136833b5e
+F src/vdbemem.c 8397a763e8cc5932b16b19daee1f8094f15f9a7d
 F src/vtab.c ce9d19ca9053812a557010fd4be7e842f8ebba2d
 F src/where.c 85719d58e0f680b5d8239dc6af82b159775d7376
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
@@ -634,7 +634,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 069f4560107246fdc31e1f15c3ad7d3dae2b9ad8
-R f45b51024a5e8c743be851676769c12e
-U danielk1977
-Z 6411c1571b3ff8cf23c5c624d3f8d386
+P 7a44fb965b3477fb78901939ba35d569e5638c19
+R 6cbdb6f56493d0a72650ba12a767bbfe
+U drh
+Z b0ab4136f4eb66dad3b479b35f66c468
index c5964fc1c4d6870bd0ab754d34766520d003cd56..b15e24bc4d5542d341e4aef48ed0dd4aff970c51 100644 (file)
@@ -1 +1 @@
-7a44fb965b3477fb78901939ba35d569e5638c19
\ No newline at end of file
+18b1ee10b89bd0a98d1986dbb04b9d6cfc3dad39
\ No newline at end of file
index f40986da5b31ca4e6ec3f0531998f31b46075ccd..e991b1f932e85971aba2b56b914526af8065a688 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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_
 #define _SQLITEINT_H_
@@ -346,6 +346,14 @@ extern const int sqlite3one;
 # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
 #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
 ** callback for a given sqlite handle. 
index a7587610bf30e141680cce86bc42376af5fb960b..e22c0bddf84d948a7d2ce2f8ed84a1031217ed91 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** 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 <ctype.h>
@@ -1155,13 +1155,13 @@ case OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */
       case OP_Divide: {
         if( a==0 ) goto arithmetic_result_is_null;
         /* 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,
         ** a SIGFPE is issued. The following statement normalizes this
         ** behaviour so that all architectures behave as if integer 
         ** overflow occured.
         */
-        if( a==-1 && b==(((i64)1)<<63) ) a = 1;
+        if( a==-1 && b==SMALLEST_INT64 ) a = 1;
         b /= a;
         break;
       }
index 9f831ecc9a443374b157401fd13a7bdb1a3dd49e..a5e4ad55f4ce8466653963e8da5af891d694ffe0 100644 (file)
@@ -310,8 +310,8 @@ static i64 doubleToInt64(double r){
   ** So we define our own static constants here using nothing
   ** larger than a 32-bit integer constant.
   */
-  static const i64 maxInt = (((i64)0x7fffffff)<<32)|0xffffffff;
-  static const i64 minInt = ((i64)0x80000000)<<32;
+  static const i64 maxInt = LARGEST_INT64;
+  static const i64 minInt = SMALLEST_INT64;
 
   if( r<(double)minInt ){
     return minInt;