Sets masked bits to a given value.
More...
#include <detray/utils/bit_encoder.hpp>
|
template<value_t mask>
requires (mask != static_cast<value_t>(0)) |
| static constexpr value_t | get_bits (const value_t v) noexcept |
| | Extract the field selected by mask from an encoded value.
|
| template<value_t... masks> |
| static constexpr bool | is_invalid (value_t v) noexcept |
| | Check whether v sets every bit in any of the supplied invalid masks.
|
template<value_t mask>
requires (mask != static_cast<value_t>(0)) |
| static constexpr void | set_bits (value_t &v, const value_t id) noexcept |
| | Set the masked bits to id in the encoded value.
|
template<typename value_t = std::uint64_t>
class detray::detail::bit_encoder< value_t >
Sets masked bits to a given value.
Given a mask and an input value, the corresponding bits are set on a target value. Used e.g. in the surface identifier.
- See also
- https://github.com/acts-project/acts/blob/main/Core/include/Acts/Geometry/GeometryIdentifier.hpp
◆ get_bits()
template<typename value_t = std::uint64_t>
template<value_t mask>
requires (
mask != static_cast<value_t>(0))
Extract the field selected by mask from an encoded value.
- Template Parameters
-
| mask | nonzero bit mask selecting the field |
- Parameters
-
| v | encoded value to inspect |
- Returns
- the masked bits from the encoded value as value of the same type.
◆ is_invalid()
template<typename value_t = std::uint64_t>
template<value_t... masks>
Check whether v sets every bit in any of the supplied invalid masks.
- Template Parameters
-
| masks | masks whose all-ones encoding is reserved as invalid |
- Parameters
-
| v | encoded value to inspect |
- Returns
- true if at least one mask is fully set in v
◆ set_bits()
template<typename value_t = std::uint64_t>
template<value_t mask>
requires (
mask != static_cast<value_t>(0))
Set the masked bits to id in the encoded value.
- Template Parameters
-
| mask | nonzero bit mask selecting the field |
- Parameters
-
| v | encoded value to update |
| id | field value to encode |