Changeset 1627 for trunk/lib


Ignore:
Timestamp:
Nov 1, 2011, 4:56:39 PM (8 years ago)
Author:
ksherdy
Message:

Updated reverse scanner clear leftmost bit logic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock_scan.hpp

    r1618 r1627  
    7272                while (this->blk > 0){
    7373                        if(this->scan_blk > 0){
    74                                 this->pos = (sizeof(scanblock_t)*8 - cbzl(this->scan_blk) -1) + ( (this->blk-1) * sizeof(scanblock_t)*8 );
    75                                 this->scan_blk = this->scan_blk & (SHIFT_MASK >> (sizeof(scanblock_t)*8 - this->pos)); // clear leftmost bit
     74                                this->pos = (sizeof(scanblock_t)*8 - count_reverse_zeroes(this->scan_blk) -1) + ( (this->blk-1) * sizeof(scanblock_t)*8 );
     75                                this->scan_blk = this->scan_blk ^ (1 << this->pos); // clear leftmost bit
    7676                                return (this->pos);
    7777                        }
     
    8989
    9090        static const uint32_t BLOCK_COUNT = sizeof(bitblock_t)/sizeof(scanblock_t);
    91         static const uint32_t SHIFT_MASK = -1;
    9291
    9392};
Note: See TracChangeset for help on using the changeset viewer.