20 #include <cuda/std/climits>
34 #define LIKELY(EXPR) __builtin_expect(!!(EXPR), 1)
36 #define LIKELY(EXPR) (!!(EXPR))
40 #define constexpr_assert(CHECK) static_cast<void>(0)
42 #define constexpr_assert(CHECK) (LIKELY(CHECK) ? void(0) : [] { assert(!#CHECK); }())
55 static_assert(CHAR_BIT == 8,
"Size of a byte must be 8 bits.");
56 return sizeof(T) * CHAR_BIT;
74 return bit_index / detail::size_in_bits<bitmask_type>();
85 return bit_index % detail::size_in_bits<bitmask_type>();
99 assert(
nullptr != bitmask);
114 assert(
nullptr != bitmask);
128 assert(
nullptr != bitmask);
146 return bitmask !=
nullptr ?
bit_is_set(bitmask, bit_index) : default_value;
159 constexpr_assert(0 <= n && n <
static_cast<size_type>(detail::size_in_bits<bitmask_type>()));
173 constexpr
size_type word_size{detail::size_in_bits<bitmask_type>()};
174 constexpr_assert(0 <= n && n < word_size);
195 assert(
nullptr != bitmask);
213 assert(
nullptr != bitmask);
constexpr CUDF_HOST_DEVICE std::size_t size_in_bits()
Returns the number of bits the given type can hold.
CUDF_HOST_DEVICE void set_bit_unsafe(bitmask_type *bitmask, size_type bit_index)
Sets the specified bit to 1
constexpr CUDF_HOST_DEVICE size_type intra_word_index(size_type bit_index)
Returns the position within a word of the specified bit.
constexpr CUDF_HOST_DEVICE size_type word_index(size_type bit_index)
Returns the index of the word containing the specified bit.
constexpr CUDF_HOST_DEVICE bitmask_type set_least_significant_bits(size_type n)
Returns a bitmask word with the n least significant bits set.
CUDF_HOST_DEVICE bool bit_value_or(bitmask_type const *bitmask, size_type bit_index, bool default_value)
optional-like interface to check if a specified bit of a bitmask is set.
CUDF_HOST_DEVICE bool bit_is_set(bitmask_type const *bitmask, size_type bit_index)
Indicates whether the specified bit is set to 1
constexpr CUDF_HOST_DEVICE bitmask_type set_most_significant_bits(size_type n)
Returns a bitmask word with the n most significant bits set.
CUDF_HOST_DEVICE void clear_bit_unsafe(bitmask_type *bitmask, size_type bit_index)
Sets the specified bit to 0
int32_t size_type
Row index type for columns and tables.
uint32_t bitmask_type
Bitmask type stored as 32-bit unsigned integer.
Type declarations for libcudf.