Changeset 1853 for trunk/lib/bitblock128.hpp
 Timestamp:
 Jan 19, 2012, 7:46:17 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/lib/bitblock128.hpp
r1826 r1853 83 83 84 84 IDISA_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; 86 86 u.bitblock = v; 87 87 uint32_t so_far = 0; 88 88 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]); 90 90 so_far += 8 * sizeof(long); 91 91 } … … 94 94 95 95 IDISA_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; 97 97 u.bitblock = v; 98 98 uint32_t so_far = 0; 99 99 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]); 101 101 so_far += 8 * sizeof(long); 102 102 }
Note: See TracChangeset
for help on using the changeset viewer.