Changeset 1552
- Timestamp:
- Oct 22, 2011, 2:41:44 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/bitblock128.hpp
r1550 r1552 32 32 static IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(bitblock128_t v); 33 33 static IDISA_ALWAYS_INLINE uint32_t count_backward_zeroes(bitblock128_t v); 34 34 static IDISA_ALWAYS_INLINE uint32_t bitstream_scan(bitblock_128_t * v, uint32_t pos) 35 35 36 36 IDISA_ALWAYS_INLINE void adc(bitblock128_t x, bitblock128_t y, bitblock128_t & carry, bitblock128_t & sum) … … 128 128 } 129 129 130 IDISA_ALWAYS_INLINE uint32_t bitstream_scan(bitblock_128_t * v, uint32_t pos) { 131 unsigned long * bitstream_ptr = (unsigned long *) (((intptr_t) v) + pos/8); 132 unsigned long bitstream_slice = ((*bitstream_ptr) >> (pos % 8)); 133 if (bitstream_slice != 0) return pos + cfzl(bitstream_slice); 134 else { 135 do { 136 bitstream_ptr++; 137 bitstream_slice = *bitstream_ptr; 138 } while (bitstream_slice == 0); 139 uint32_t base_posn = 8*((intptr_t) bitstream_ptr - (intptr_t) v); 140 return base_posn + cfzl(bitstream_slice); 141 } 142 } 143 144 130 145 #endif /* BITBLOCK128_HPP_ */
Note: See TracChangeset
for help on using the changeset viewer.