10 #include <cuda/std/climits>
19 namespace CUDF_EXPORT
cudf {
31 static_assert(CHAR_BIT == 8,
"Size of a byte must be 8 bits.");
32 return sizeof(T) * CHAR_BIT;
50 return bit_index / detail::size_in_bits<bitmask_type>();
61 return bit_index % detail::size_in_bits<bitmask_type>();
75 assert(
nullptr != bitmask);
90 assert(
nullptr != bitmask);
104 assert(
nullptr != bitmask);
122 return bitmask !=
nullptr ?
bit_is_set(bitmask, bit_index) : default_value;
135 assert(0 <= n && n <
static_cast<size_type>(detail::size_in_bits<bitmask_type>()));
149 constexpr
size_type word_size{detail::size_in_bits<bitmask_type>()};
150 assert(0 <= n && n < word_size);
171 assert(
nullptr != bitmask);
189 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.