Bit manipulation utility functions.
More...
#include <stdint.h>
Go to the source code of this file.
|
| template<typename T> |
| constexpr uint8_t | bit_clear (T &_dest, const uint8_t bit) |
| | Clear the specified bit.
|
| |
| template<typename T> |
| constexpr uint8_t | bit_read (const T &_src, const uint8_t bit) |
| | Read the specified bit.
|
| |
| template<typename T> |
| constexpr void | bit_set (T &_dest, const uint8_t bit) |
| | Set the specified bit to 1.
|
| |
Bit manipulation utility functions.
- Author
- Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
- Version
- 0.1
- Date
- 2026-01-29
- Copyright
- Copyright (c) 2025-2026
- Note
- These functions are pure C++ with no Arduino dependencies, making them usable in both embedded and native test environments.
Definition in file utils_bits.h.
◆ bit_clear()
template<typename T>
| uint8_t bit_clear |
( |
T & | _dest, |
|
|
const uint8_t | bit ) |
|
constexpr |
Clear the specified bit.
- Template Parameters
-
- Parameters
-
| _dest | Integer variable to modify |
| bit | Bit to clear in _dest |
- Returns
- constexpr uint8_t
Definition at line 55 of file utils_bits.h.
◆ bit_read()
template<typename T>
| uint8_t bit_read |
( |
const T & | _src, |
|
|
const uint8_t | bit ) |
|
constexpr |
Read the specified bit.
- Template Parameters
-
- Parameters
-
| _src | Integer variable to read |
| bit | Bit to read in _src |
- Returns
- constexpr uint8_t
Definition at line 41 of file utils_bits.h.
◆ bit_set()
template<typename T>
| void bit_set |
( |
T & | _dest, |
|
|
const uint8_t | bit ) |
|
constexpr |
Set the specified bit to 1.
- Template Parameters
-
- Parameters
-
| _dest | Integer variable to modify |
| bit | Bit to set in _dest |
Definition at line 27 of file utils_bits.h.