Changeset 2037
- Timestamp:
- Apr 20, 2012, 10:18:00 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/bitblock.hpp
r1970 r2037 40 40 static IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(BitBlock v); 41 41 static IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(BitBlock v); 42 static IDISA_ALWAYS_INLINE BitBlock mask_forward_zeroes(uint32_t count); 43 static IDISA_ALWAYS_INLINE BitBlock mask_reverse_zeroes(uint32_t count); 42 44 static IDISA_ALWAYS_INLINE uint32_t bitstream_scan(BitBlock * v, uint32_t pos); 43 45 static IDISA_ALWAYS_INLINE BitBlock assert_align(BitBlock v); … … 79 81 } 80 82 83 IDISA_ALWAYS_INLINE BitBlock mask_forward_zeroes(uint32_t count) { 84 if (count >= sizeof(BitBlock) * 8) return simd<1>::constant<0>(); 85 else return bitblock::sll(simd<1>::constant<1>(), convert(count)); 86 } 87 81 88 IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(BitBlock v) { 82 89 union {BitBlock bitblock; scanword_t elems[sizeof(BitBlock)/sizeof(scanword_t)];} u; … … 88 95 } 89 96 return so_far; 97 } 98 99 IDISA_ALWAYS_INLINE BitBlock mask_reverse_zeroes(uint32_t count) { 100 if (count >= sizeof(BitBlock) * 8) return simd<1>::constant<0>(); 101 else return bitblock::srl(simd<1>::constant<1>(), convert(count)); 90 102 } 91 103
Note: See TracChangeset
for help on using the changeset viewer.