aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-03-16 01:16:30 +0000
committerdrh <drh@noemail.net>2016-03-16 01:16:30 +0000
commit47e1842e5bd5c5f467b0290f3fde9df69fa42a25 (patch)
tree69786029a35258e2ee2a76f5d023764e19a074f0 /src/util.c
parentc5c67abb9ab2c58d41f75a41a1693e4b30e00bd5 (diff)
parent32f57d4c373c8f49b59f4a40149c136ef8a5632b (diff)
downloadsqlite-47e1842e5bd5c5f467b0290f3fde9df69fa42a25.tar.gz
sqlite-47e1842e5bd5c5f467b0290f3fde9df69fa42a25.zip
Merge all recent enhancements from trunk.
FossilOrigin-Name: 6a7ee04b0ddac36a87d5ed2ac89a53e537f4d5a3
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/util.c b/src/util.c
index 6aead47fa..d6a6f6b95 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1424,9 +1424,14 @@ u64 sqlite3LogEstToInt(LogEst x){
x /= 10;
if( n>=5 ) n -= 2;
else if( n>=1 ) n -= 1;
- if( x>=3 ){
- return x>60 ? (u64)LARGEST_INT64 : (n+8)<<(x-3);
- }
- return (n+8)>>(3-x);
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
+ defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
+ if( x>60 ) return (u64)LARGEST_INT64;
+#else
+ /* If only SQLITE_ENABLE_STAT3_OR_STAT4 is on, then the largest input
+ ** possible to this routine is 310, resulting in a maximum x of 31 */
+ assert( x<=60 );
+#endif
+ return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
}
#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */