aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-03-10 14:28:24 +0000
committerdrh <drh@noemail.net>2016-03-10 14:28:24 +0000
commitecdf20d3a420d3c5d31238cae6422751f8be824c (patch)
tree2fdf3fbbb9c1d8b4887f54b54f6b9c3907e3dce5 /src/util.c
parent6459ca0b8ceb8a8ac6008c810667d7060836b939 (diff)
downloadsqlite-ecdf20d3a420d3c5d31238cae6422751f8be824c.tar.gz
sqlite-ecdf20d3a420d3c5d31238cae6422751f8be824c.zip
Use #ifdefs to remove code that is unreachable in some configurations, replacing
it with an assert(). FossilOrigin-Name: f96ec84d605fd73c323344a753acf35b76307af9
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 */