/ Check-in [be2570c0]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: be2570c061e1e751d1a46450bd1186549146526e
User & Date: danielk1977 2007-06-26 12:52:34
Context
2007-06-26
12:54
Reorganize comments in fts2_tokenizer.h. No code changes. (CVS 4132) check-in: b331e303 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: be2570c0 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: c6dfd9e4 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.633 2007/06/26 11:13:26 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.634 2007/06/26 12:52:34 danielk1977 Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include <math.h>
    52     52   #include "vdbeInt.h"
    53     53   
................................................................................
  1156   1156           /* Dividing the largest possible negative 64-bit integer (1<<63) by 
  1157   1157           ** -1 returns an integer to large to store in a 64-bit data-type. On
  1158   1158           ** some architectures, the value overflows to (1<<63). On others,
  1159   1159           ** a SIGFPE is issued. The following statement normalizes this
  1160   1160           ** behaviour so that all architectures behave as if integer 
  1161   1161           ** overflow occured.
  1162   1162           */
  1163         -        if( a==-1 && b==(1<<63) ) a = 1;
         1163  +        if( a==-1 && b==(((i64)1)<<63) ) a = 1;
  1164   1164           b /= a;
  1165   1165           break;
  1166   1166         }
  1167   1167         default: {
  1168   1168           if( a==0 ) goto divide_by_zero;
  1169   1169           if( a==-1 ) a = 1;
  1170   1170           b %= a;