3-phase PV router
Loading...
Searching...
No Matches
utils_bits.h File Reference

Bit manipulation utility functions. More...

#include <stdint.h>
Include dependency graph for utils_bits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
 

Detailed Description

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
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.

Function Documentation

◆ bit_clear()

template<typename T>
uint8_t bit_clear ( T & _dest,
const uint8_t bit )
constexpr

Clear the specified bit.

Template Parameters
TType of the variable
Parameters
_destInteger variable to modify
bitBit to clear in _dest
Returns
constexpr uint8_t

Definition at line 55 of file utils_bits.h.

Here is the caller graph for this function:

◆ bit_read()

template<typename T>
uint8_t bit_read ( const T & _src,
const uint8_t bit )
constexpr

Read the specified bit.

Template Parameters
TType of the variable
Parameters
_srcInteger variable to read
bitBit to read in _src
Returns
constexpr uint8_t

Definition at line 41 of file utils_bits.h.

Here is the caller graph for this function:

◆ bit_set()

template<typename T>
void bit_set ( T & _dest,
const uint8_t bit )
constexpr

Set the specified bit to 1.

Template Parameters
TType of the variable
Parameters
_destInteger variable to modify
bitBit to set in _dest

Definition at line 27 of file utils_bits.h.

Here is the caller graph for this function: