Skip to content

Commit 9cf4926

Browse files
committed
Remove redundant computations
1 parent 7347255 commit 9cf4926

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/xsimd/arch/common/xsimd_common_logical.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ namespace xsimd
3535
template <class A, class T>
3636
XSIMD_INLINE size_t countl_zero(batch_bool<T, A> const& self, requires_arch<common>) noexcept
3737
{
38-
constexpr size_t unused_bits = sizeof(uint64_t) * CHAR_BIT - batch_bool<T, A>::size;
38+
constexpr size_t unused_bits = 64 - batch_bool<T, A>::size;
3939
constexpr uint64_t lower_mask = batch_bool<T, A>::size < 64 ? ((uint64_t)1 << batch_bool<T, A>::size) - 1 : (uint64_t)-1;
4040
return xsimd::detail::countl_zero(self.mask() & lower_mask) - unused_bits;
4141
}
4242

4343
template <class A, class T>
4444
XSIMD_INLINE size_t countl_one(batch_bool<T, A> const& self, requires_arch<common>) noexcept
4545
{
46-
constexpr size_t unused_bits = sizeof(uint64_t) * CHAR_BIT - batch_bool<T, A>::size;
46+
constexpr size_t unused_bits = 64 - batch_bool<T, A>::size;
4747
constexpr uint64_t upper_mask = batch_bool<T, A>::size < 64 ? ~(((uint64_t)1 << batch_bool<T, A>::size) - 1) : (uint64_t)0;
4848
return xsimd::detail::countl_one(self.mask() | upper_mask) - unused_bits;
4949
}

0 commit comments

Comments
 (0)