1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Use #ifdefs to remove code that is unreachable in some configurations, replacing

it with an assert().

FossilOrigin-Name: f96ec84d605fd73c323344a753acf35b76307af9
This commit is contained in:
drh
2016-03-10 14:28:24 +00:00
parent 6459ca0b8c
commit ecdf20d3a4
3 changed files with 16 additions and 11 deletions

View File

@@ -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 */