21 #include <cuda/std/climits>
30 namespace CUDF_EXPORT
cudf {
36 #define LIKELY(EXPR) __builtin_expect(!!(EXPR), 1)
38 #define LIKELY(EXPR) (!!(EXPR))
42 #define constexpr_assert(CHECK) static_cast<void>(0)
44 #define constexpr_assert(CHECK) (LIKELY(CHECK) ? void(0) : [] { assert(!#CHECK); }())
57 static_assert(CHAR_BIT == 8,
"Size of a byte must be 8 bits.");
58 return sizeof(T) * CHAR_BIT;
76 return bit_index / detail::size_in_bits<bitmask_type>();
87 return bit_index % detail::size_in_bits<bitmask_type>();
101 assert(
nullptr != bitmask);
116 assert(
nullptr != bitmask);
130 assert(
nullptr != bitmask);
148 return bitmask !=
nullptr ?
bit_is_set(bitmask, bit_index) : default_value;
161 constexpr_assert(0 <= n && n <
static_cast<size_type>(detail::size_in_bits<bitmask_type>()));
175 constexpr
size_type word_size{detail::size_in_bits<bitmask_type>()};
176 constexpr_assert(0 <= n && n < word_size);
197 assert(
nullptr != bitmask);
215 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.
#define CUDF_HOST_DEVICE
Indicates that the function or method is usable on host and device.