Files | Functions
Bitmask

Files

file  bit.hpp
 Utilities for bit and bitmask operations.
 

Functions

constexpr CUDA_HOST_DEVICE_CALLABLE size_type cudf::word_index (size_type bit_index)
 Returns the index of the word containing the specified bit.
 
constexpr CUDA_HOST_DEVICE_CALLABLE size_type cudf::intra_word_index (size_type bit_index)
 Returns the position within a word of the specified bit.
 
CUDA_HOST_DEVICE_CALLABLE void cudf::set_bit_unsafe (bitmask_type *bitmask, size_type bit_index)
 Sets the specified bit to 1 More...
 
CUDA_HOST_DEVICE_CALLABLE void cudf::clear_bit_unsafe (bitmask_type *bitmask, size_type bit_index)
 Sets the specified bit to 0 More...
 
CUDA_HOST_DEVICE_CALLABLE bool cudf::bit_is_set (bitmask_type const *bitmask, size_type bit_index)
 Indicates whether the specified bit is set to 1 More...
 
constexpr CUDA_HOST_DEVICE_CALLABLE bitmask_type cudf::set_least_significant_bits (size_type n)
 Returns a bitmask word with the n least significant bits set. More...
 
constexpr CUDA_HOST_DEVICE_CALLABLE bitmask_type cudf::set_most_significant_bits (size_type n)
 Returns a bitmask word with the n most significant bits set. More...
 

Detailed Description

Function Documentation

◆ bit_is_set()

CUDA_HOST_DEVICE_CALLABLE bool cudf::bit_is_set ( bitmask_type const *  bitmask,
size_type  bit_index 
)

Indicates whether the specified bit is set to 1

Parameters
bit_indexIndex of the bit to test
Returns
true The specified bit is 1
false The specified bit is 0

Definition at line 111 of file bit.hpp.

◆ clear_bit_unsafe()

CUDA_HOST_DEVICE_CALLABLE void cudf::clear_bit_unsafe ( bitmask_type *  bitmask,
size_type  bit_index 
)

Sets the specified bit to 0

This function is not thread-safe, i.e., attempting to update bits within the same word concurrently from multiple threads results in undefined behavior.

Parameters
bitmaskThe bitmask containing the bit to clear
bit_indexThe index of the bit to clear

Definition at line 98 of file bit.hpp.

◆ set_bit_unsafe()

CUDA_HOST_DEVICE_CALLABLE void cudf::set_bit_unsafe ( bitmask_type *  bitmask,
size_type  bit_index 
)

Sets the specified bit to 1

This function is not thread-safe, i.e., attempting to update bits within the same word concurrently from multiple threads results in undefined behavior.

Parameters
bitmaskThe bitmask containing the bit to set
bit_indexIndex of the bit to set

Definition at line 83 of file bit.hpp.

◆ set_least_significant_bits()

constexpr CUDA_HOST_DEVICE_CALLABLE bitmask_type cudf::set_least_significant_bits ( size_type  n)
constexpr

Returns a bitmask word with the n least significant bits set.

Behavior is undefined if n < 0 or if n >= size_in_bits<bitmask_type>()

Parameters
nThe number of least significant bits to set
Returns
A bitmask word with n least significant bits set

Definition at line 125 of file bit.hpp.

◆ set_most_significant_bits()

constexpr CUDA_HOST_DEVICE_CALLABLE bitmask_type cudf::set_most_significant_bits ( size_type  n)
constexpr

Returns a bitmask word with the n most significant bits set.

Behavior is undefined if n < 0 or if n >= size_in_bits<bitmask_type>()

Parameters
nThe number of most significant bits to set
Returns
A bitmask word with n most significant bits set

Definition at line 139 of file bit.hpp.