4#ifndef TETL_BIT_FLIP_BIT_HPP
5#define TETL_BIT_FLIP_BIT_HPP
7#include <etl/_concepts/builtin_unsigned_integer.hpp>
8#include <etl/_contracts/check.hpp>
9#include <etl/_cstddef/size_t.hpp>
10#include <etl/_limits/numeric_limits.hpp>
19template <
etl::builtin_unsigned_integer UInt>
20[[nodiscard]]
constexpr auto flip_bit(UInt word, UInt pos)
noexcept -> UInt
22 TETL_PRECONDITION(
static_cast<
int>(pos) < etl::numeric_limits<UInt>::digits);
23 return static_cast<UInt>(word ^
static_cast<UInt>(UInt(1) << pos));
30template <
etl::size_t Pos,
etl::builtin_unsigned_integer UInt>
31[[nodiscard]]
constexpr auto flip_bit(UInt word)
noexcept -> UInt
34 return etl::flip_bit(word,
static_cast<UInt>(Pos));
constexpr auto flip_bit(UInt word) noexcept -> UInt
Flip bit at position Pos.
Definition flip_bit.hpp:31
constexpr auto flip_bit(UInt word, UInt pos) noexcept -> UInt
Flip bit at position pos.
Definition flip_bit.hpp:20
Definition adjacent_find.hpp:9
Definition numeric_limits.hpp:18