/ Check-in [9b3a7281]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Very small size reduction and performance increase in sqlite3BitvecTest().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9b3a7281bd45994edf813a687e4b7a0761697929
User & Date: drh 2015-06-29 03:28:43
Context
2015-06-29
04:21
Add the new PGHDR_CLEAN bit to PgHdr.flags in pcache.c. This bit is always the opposite of PGHDR_DIRTY. Use the extra bit to avoid a comparison for a small performance boost. check-in: 8619fc34 user: drh tags: trunk
03:28
Very small size reduction and performance increase in sqlite3BitvecTest(). check-in: 9b3a7281 user: drh tags: trunk
00:52
Move an assert() and testcase() into their correct position within getAndInitPage(). check-in: 18115164 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/bitvec.c.

124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
/*
** Check to see if the i-th bit is set.  Return true or false.
** If p is NULL (if the bitmap has not been created) or if
** i is out of range, then return false.
*/
int sqlite3BitvecTest(Bitvec *p, u32 i){
  if( p==0 ) return 0;
  if( i>p->iSize || i==0 ) return 0;
  i--;

  while( p->iDivisor ){
    u32 bin = i/p->iDivisor;
    i = i%p->iDivisor;
    p = p->u.apSub[bin];
    if (!p) {
      return 0;
    }







<

>







124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
/*
** Check to see if the i-th bit is set.  Return true or false.
** If p is NULL (if the bitmap has not been created) or if
** i is out of range, then return false.
*/
int sqlite3BitvecTest(Bitvec *p, u32 i){
  if( p==0 ) return 0;

  i--;
  if( i>=p->iSize ) return 0;
  while( p->iDivisor ){
    u32 bin = i/p->iDivisor;
    i = i%p->iDivisor;
    p = p->u.apSub[bin];
    if (!p) {
      return 0;
    }