Faster implementation for sqlite3MulInt64().
FossilOrigin-Name: 010c48f671e909cb406f3716102a0032bc72a592
This commit is contained in:
parent
1b27b8c0a0
commit
53a6eb3f3c
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Faster\sand\ssmaller\simplementation\sof\ssqlite3_value_type().
|
||||
D 2014-02-10T03:21:57.367
|
||||
C Faster\simplementation\sfor\ssqlite3MulInt64().
|
||||
D 2014-02-10T12:59:15.771
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -278,7 +278,7 @@ F src/tokenize.c 6da2de6e12218ccb0aea5184b56727d011f4bee7
|
||||
F src/trigger.c a417d386e214f0abd2e0f756b834b4d9f4d3368a
|
||||
F src/update.c a7df6fffce6bfedc578fda6136dd33e34a63f8ee
|
||||
F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
|
||||
F src/util.c 15ac2627f548f5481d0d7e6c4eb67be673027695
|
||||
F src/util.c c46c90459ef9bdc0c6c73803cf4c55425b4771cf
|
||||
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
|
||||
F src/vdbe.c 66c3e5c49ff61aaa3e3182fb9962ceddb847b05f
|
||||
F src/vdbe.h e6c4c610fcabad4fa80ebb1efc6822a9367e2b26
|
||||
@ -1152,7 +1152,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P 532995759114ab7a7cba18cc9d8820d78eb1a96e
|
||||
R 1d6572df35f58f7e82be516ccbec8b1d
|
||||
P 5708bc24b8cab623b833121183042b43e5a7021b
|
||||
R 96b6443498b3eb7df60c900f013f8cef
|
||||
U drh
|
||||
Z d879d19c9c74c4f3aa3952d43b5ccba0
|
||||
Z d856cf5d0cd482b54ac364a01a0fe1f8
|
||||
|
@ -1 +1 @@
|
||||
5708bc24b8cab623b833121183042b43e5a7021b
|
||||
010c48f671e909cb406f3716102a0032bc72a592
|
18
src/util.c
18
src/util.c
@ -1123,13 +1123,12 @@ int sqlite3AddInt64(i64 *pA, i64 iB){
|
||||
testcase( iA>0 && LARGEST_INT64 - iA == iB );
|
||||
testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 );
|
||||
if( iA>0 && LARGEST_INT64 - iA < iB ) return 1;
|
||||
*pA += iB;
|
||||
}else{
|
||||
testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );
|
||||
testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 );
|
||||
if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1;
|
||||
*pA += iB;
|
||||
}
|
||||
*pA += iB;
|
||||
return 0;
|
||||
}
|
||||
int sqlite3SubInt64(i64 *pA, i64 iB){
|
||||
@ -1153,9 +1152,18 @@ int sqlite3MulInt64(i64 *pA, i64 iB){
|
||||
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;
|
||||
if( iA1==0 ){
|
||||
if( iB1==0 ){
|
||||
*pA *= iB;
|
||||
return 0;
|
||||
}
|
||||
r = iA0*iB1;
|
||||
}else if( iB1==0 ){
|
||||
r = iA1*iB0;
|
||||
}else{
|
||||
/* If both iA1 and iB1 are non-zero, overflow will result */
|
||||
return 1;
|
||||
}
|
||||
testcase( r==(-TWOPOWER31)-1 );
|
||||
testcase( r==(-TWOPOWER31) );
|
||||
testcase( r==TWOPOWER31 );
|
||||
|
Loading…
Reference in New Issue
Block a user