Library for bit manipulation.
|
Library for bit manipulation. More...
#include <concepts>
#include <limits>
#include <type_traits>
Go to the source code of this file.
Typedefs | |
template<typename... Ts> | |
using | org::ttldtor::bits::Max = detail::MaxImpl<Ts...>::Type |
Returns max type by size (first is better) | |
Functions | |
template<std::integral ValueType, std::integral ShiftType> | |
constexpr ValueType | org::ttldtor::bits::sar (ValueType value, ShiftType shift) noexcept |
Performs a right arithmetic bit shift operation (>> in Java, C, etc.). | |
template<std::integral ValueType, std::unsigned_integral UnsignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::leftArithmeticShift (ValueType value, UnsignedShiftType shift) noexcept |
Performs a left arithmetic bit shift operation (sal , << in Java, C, etc.). | |
template<std::integral ValueType, std::signed_integral SignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::leftArithmeticShift (ValueType value, SignedShiftType shift) noexcept |
Performs a left arithmetic bit shift operation (sal , << in Java, C, etc.). | |
template<std::integral ValueType, std::integral ShiftType> | |
constexpr ValueType | org::ttldtor::bits::sal (ValueType value, ShiftType shift) noexcept |
Performs a left arithmetic bit shift operation (<< in Java, C, etc.). | |
template<std::integral ValueType, std::unsigned_integral UnsignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::rightArithmeticShift (ValueType value, UnsignedShiftType shift) noexcept |
Performs a right arithmetic bit shift operation (sar , >> in Java, C, etc.). | |
template<std::integral ValueType, std::signed_integral SignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::rightArithmeticShift (ValueType value, SignedShiftType shift) noexcept |
Performs a right arithmetic bit shift operation (sar , >> in Java, C, etc.). | |
template<std::integral ValueType, std::integral ShiftType> | |
constexpr ValueType | org::ttldtor::bits::shr (ValueType value, ShiftType shift) noexcept |
Performs a right logical bit shift operation (>>> in Java). | |
template<std::integral ValueType, std::unsigned_integral UnsignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::leftLogicalShift (ValueType value, UnsignedShiftType shift) noexcept |
Performs a left logical bit shift operation (shl , <<< ). | |
template<std::integral ValueType, std::integral SignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::leftLogicalShift (ValueType value, SignedShiftType shift) noexcept |
Performs a left logical bit shift operation (shl , <<< ). | |
template<std::integral ValueType, std::integral ShiftType> | |
constexpr ValueType | org::ttldtor::bits::shl (ValueType value, ShiftType shift) noexcept |
Performs a left logical bit shift operation (shl , <<< ). | |
template<std::integral ValueType, std::unsigned_integral UnsignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::rightLogicalShift (ValueType value, UnsignedShiftType shift) noexcept |
Performs a right logical bit shift operation (shr , >>> in Java). | |
template<std::integral ValueType, std::signed_integral SignedShiftType> | |
constexpr ValueType | org::ttldtor::bits::rightLogicalShift (ValueType value, SignedShiftType shift) noexcept |
Performs a right logical bit shift operation (shr , >>> in Java). | |
template<std::integral FirstType, std::integral SecondType> | |
constexpr FirstType | org::ttldtor::bits::andOp (FirstType first, SecondType second) noexcept |
Performs a bitwise AND operation between two values of possibly different types and ensures the result is cast back to the type of the first argument. | |
template<std::integral FirstType, std::integral SecondType> | |
constexpr FirstType | org::ttldtor::bits::orOp (FirstType first, SecondType second) noexcept |
Performs a bitwise OR operation between two values of possibly different types and ensures the result is cast back to the type of the first argument. | |
template<std::integral FirstType, std::integral SecondType> | |
constexpr FirstType | org::ttldtor::bits::xorOp (FirstType first, SecondType second) noexcept |
Performs a bitwise XOR operation between two values of possibly different types and ensures the result is cast back to the type of the first argument. | |
template<std::unsigned_integral T> | |
constexpr bool | org::ttldtor::bits::bitsAreSet (T sourceBits, T bitMaskToCheck) |
Determines if the specified bits are set in the source value. | |
template<std::integral SourceBitsType, std::integral BitMaskType> | |
constexpr bool | org::ttldtor::bits::bitsAreSet (SourceBitsType sourceBits, BitMaskType bitMaskToCheck) |
Determines if the specified bits are set in the source value. | |
template<std::unsigned_integral T> | |
constexpr T | org::ttldtor::bits::setBits (T sourceBits, T bitMaskToSet) |
Sets specific bits in the source value using a bitmask. | |
template<std::integral SourceBitsType, std::integral BitMaskType> | |
constexpr SourceBitsType | org::ttldtor::bits::setBits (SourceBitsType sourceBits, BitMaskType bitMaskToSet) |
Sets specific bits in the source value using a bitmask. | |
template<std::unsigned_integral T> | |
constexpr T | org::ttldtor::bits::resetBits (T sourceBits, T bitMaskToReset) |
Resets (clears) specific bits in a bitmask. | |
template<std::integral SourceBitsType, std::integral BitMaskType> | |
constexpr SourceBitsType | org::ttldtor::bits::resetBits (SourceBitsType sourceBits, BitMaskType bitMaskToReset) |
Resets (clears) specific bits in a bitmask. | |
Library for bit manipulation.