Ignore:
Timestamp:
Jan 19, 2012, 7:46:17 PM (7 years ago)
Author:
ksherdy
Message:

Removed count forward, count reverse wrappers, and introduced
scan_word_t type for compile time architecture dependent scans.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock128.hpp

    r1826 r1853  
    8383
    8484IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(bitblock128_t v) {
    85         union {bitblock128_t bitblock; unsigned long elems[sizeof(bitblock128_t)/sizeof(long)];} u;
     85        union {bitblock128_t bitblock; scanword_t elems[sizeof(bitblock128_t)/sizeof(scanword_t)];} u;
    8686        u.bitblock = v;
    8787  uint32_t so_far = 0;
    8888  for (int i = 0; i < sizeof(bitblock128_t)/sizeof(long); i++) {
    89     if (u.elems[i] != 0) return so_far + cfzl(u.elems[i]);
     89    if (u.elems[i] != 0) return so_far + scan_forward_zeroes(u.elems[i]);
    9090    so_far += 8 * sizeof(long);
    9191  }
     
    9494
    9595IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(bitblock128_t v) {
    96         union {bitblock128_t bitblock; unsigned long elems[sizeof(bitblock128_t)/sizeof(long)];} u;
     96        union {bitblock128_t bitblock; scanword_t elems[sizeof(bitblock128_t)/sizeof(scanword_t)];} u;
    9797        u.bitblock = v;
    9898  uint32_t so_far = 0;
    9999  for (int i = sizeof(bitblock128_t)/sizeof(long) - 1; i >= 0; i--) {
    100     if (u.elems[i] != 0) return so_far + cbzl(u.elems[i]);
     100    if (u.elems[i] != 0) return so_far + scan_backward_zeroes(u.elems[i]);
    101101    so_far += 8 * sizeof(long);
    102102  }
Note: See TracChangeset for help on using the changeset viewer.