SQLite

Check-in [be2570c061]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use (((i64)1)<<63) instead of just (1<<63) to compute the most negative 64-bit integer. (CVS 4131)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: be2570c061e1e751d1a46450bd1186549146526e
User & Date: danielk1977 2007-06-26 12:52:34.000
Context
2007-06-26
12:54
Reorganize comments in fts2_tokenizer.h. No code changes. (CVS 4132) (check-in: b331e30395 user: danielk1977 tags: trunk)
12:52
Use (((i64)1)<<63) instead of just (1<<63) to compute the most negative 64-bit integer. (CVS 4131) (check-in: be2570c061 user: danielk1977 tags: trunk)
11:13
Fix for #2444: Avoid SIGFPE on 64-bit platforms when evaluating expressions like ((1<<63)/-1). (CVS 4130) (check-in: c6dfd9e434 user: danielk1977 tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/vdbe.c.
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53







-
+







**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** 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.633 2007/06/26 11:13:26 danielk1977 Exp $
** $Id: vdbe.c,v 1.634 2007/06/26 12:52:34 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <math.h>
#include "vdbeInt.h"

1156
1157
1158
1159
1160
1161
1162
1163

1164
1165
1166
1167
1168
1169
1170
1156
1157
1158
1159
1160
1161
1162

1163
1164
1165
1166
1167
1168
1169
1170







-
+







        /* 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
        ** 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==(1<<63) ) a = 1;
        if( a==-1 && b==(((i64)1)<<63) ) a = 1;
        b /= a;
        break;
      }
      default: {
        if( a==0 ) goto divide_by_zero;
        if( a==-1 ) a = 1;
        b %= a;