Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Simplifications to the overflow-free multiplier. Also remove some commented-out code that was left in that subroutine by mistake on the previous check-in. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
55fc25fdab61e6094289e068c343e012 |
User & Date: | drh 2011-03-05 21:41:34.187 |
Context
2011-03-06
| ||
21:28 | Remove dead code identified by the clang static analyzer. (check-in: 01a79d5a7a user: drh tags: trunk) | |
2011-03-05
| ||
21:41 | Simplifications to the overflow-free multiplier. Also remove some commented-out code that was left in that subroutine by mistake on the previous check-in. (check-in: 55fc25fdab user: drh tags: trunk) | |
20:59 | Fix all known instances of signed-integer overflow. Within SQL expressions, integer overflow now forces coercion to floating point. The shift operators work with any integer right-hand operand with negative values reversing the direction of the shift. (check-in: abf2139412 user: drh tags: trunk) | |
Changes
Changes to src/util.c.
︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 | } #define TWOPOWER32 (((i64)1)<<32) #define TWOPOWER31 (((i64)1)<<31) int sqlite3MulInt64(i64 *pA, i64 iB){ i64 iA = *pA; i64 iA1, iA0, iB1, iB0, r; | < < > | < | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 | } #define TWOPOWER32 (((i64)1)<<32) #define TWOPOWER31 (((i64)1)<<31) int sqlite3MulInt64(i64 *pA, i64 iB){ i64 iA = *pA; i64 iA1, iA0, iB1, iB0, r; iA1 = iA/TWOPOWER32; iA0 = iA % TWOPOWER32; iB1 = iB/TWOPOWER32; iB0 = iB % TWOPOWER32; if( iA1*iB1 != 0 ) return 1; assert( iA1*iB0==0 || iA0*iB1==0 ); r = iA1*iB0 + iA0*iB1; testcase( r==(-TWOPOWER31)-1 ); testcase( r==(-TWOPOWER31) ); testcase( r==TWOPOWER31 ); testcase( r==TWOPOWER31-1 ); if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1; r *= TWOPOWER32; if( sqlite3AddInt64(&r, iA0*iB0) ) return 1; |
︙ | ︙ |