21 #include <cuda/std/climits>
30 namespace CUDF_EXPORT
cudf {
42 static_assert(CHAR_BIT == 8,
"Size of a byte must be 8 bits.");
43 return sizeof(T) * CHAR_BIT;
61 return bit_index / detail::size_in_bits<bitmask_type>();
72 return bit_index % detail::size_in_bits<bitmask_type>();
86 assert(
nullptr != bitmask);
101 assert(
nullptr != bitmask);
115 assert(
nullptr != bitmask);
133 return bitmask !=
nullptr ?
bit_is_set(bitmask, bit_index) : default_value;
146 assert(0 <= n && n <
static_cast<size_type>(detail::size_in_bits<bitmask_type>()));
160 constexpr
size_type word_size{detail::size_in_bits<bitmask_type>()};
161 assert(0 <= n && n < word_size);
182 assert(
nullptr != bitmask);
200 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.