FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
bits.h File Reference

Useful bits manipulation utilities. More...

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

Go to the source code of this file.

Namespaces

namespace  bits
 Defines utility methods for bits manipulation.
 

Functions

static constexpr uint8_t bits::BV8 (uint8_t bit)
 Create a uint8_t bitmask for the given bit number. More...
 
static constexpr uint8_t bits::BV8 (uint8_t bit1, uint8_t bit2)
 Create a uint8_t bitmask for the given bits numbers. More...
 
static constexpr uint8_t bits::BV8 (uint8_t bit1, uint8_t bit2, uint8_t bit3)
 Create a uint8_t bitmask for the given bits numbers. More...
 
static constexpr uint8_t bits::BV8 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4)
 Create a uint8_t bitmask for the given bits numbers. More...
 
static constexpr uint8_t bits::BV8 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4, uint8_t bit5)
 Create a uint8_t bitmask for the given bits numbers. More...
 
static constexpr uint8_t bits::BV8 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4, uint8_t bit5, uint8_t bit6)
 Create a uint8_t bitmask for the given bits numbers. More...
 
static constexpr uint8_t bits::CBV8 (uint8_t bit)
 Create a uint8_t inverted bitmask for the given bit number. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit)
 Create a uint16_t bitmask for the given bit number. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit1, uint8_t bit2)
 Create a uint16_t bitmask for the given bits numbers. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit1, uint8_t bit2, uint8_t bit3)
 Create a uint16_t bitmask for the given bits numbers. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4)
 Create a uint16_t bitmask for the given bits numbers. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4, uint8_t bit5)
 Create a uint16_t bitmask for the given bits numbers. More...
 
static constexpr uint16_t bits::BV16 (uint8_t bit1, uint8_t bit2, uint8_t bit3, uint8_t bit4, uint8_t bit5, uint8_t bit6)
 Create a uint16_t bitmask for the given bits numbers. More...
 
static constexpr uint16_t bits::CBV16 (uint8_t bit)
 Create a uint16_t inverted bitmask for the given bit number. More...
 
static constexpr uint8_t bits::COMPL (uint8_t value)
 Return the uint8_t 2-complement of a byte. More...
 
static constexpr uint8_t bits::LOW_BYTE (uint16_t value)
 Extract the low byte (aka Least Significant Byte, LSB) of a uint16_t value. More...
 
static constexpr uint8_t bits::HIGH_BYTE (uint16_t value)
 Extract the high byte (aka Most Significant Byte, MSB) of a uint16_t value. More...
 
static constexpr uint8_t bits::OR8 (uint8_t val1, uint8_t val2)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands. More...
 
static constexpr uint8_t bits::OR8 (uint8_t val1, uint8_t val2, uint8_t val3)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands. More...
 
static constexpr uint8_t bits::OR8 (uint8_t val1, uint8_t val2, uint8_t val3, uint8_t val4)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands. More...
 
static constexpr uint8_t bits::OR8 (uint8_t val1, uint8_t val2, uint8_t val3, uint8_t val4, uint8_t val5)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands. More...
 
static constexpr uint8_t bits::OR8 (uint8_t val1, uint8_t val2, uint8_t val3, uint8_t val4, uint8_t val5, uint8_t val6)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands. More...
 
static constexpr uint8_t bits::IF8 (bool flag, uint8_t val)
 return val if flag is true, otherwise 0, as an uint8_t. More...
 
static constexpr uint8_t bits::ORIF8 (bool flag1, uint8_t val1, bool flag2, uint8_t val2)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands, conditioned by bool flags. More...
 
static constexpr uint8_t bits::ORIF8 (bool flag1, uint8_t val1, bool flag2, uint8_t val2, bool flag3, uint8_t val3)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands, conditioned by bool flags. More...
 
static constexpr uint8_t bits::ORIF8 (bool flag1, uint8_t val1, bool flag2, uint8_t val2, bool flag3, uint8_t val3, bool flag4, uint8_t val4)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands, conditioned by bool flags. More...
 
static constexpr uint8_t bits::ORIF8 (bool flag1, uint8_t val1, bool flag2, uint8_t val2, bool flag3, uint8_t val3, bool flag4, uint8_t val4, bool flag5, uint8_t val5)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands, conditioned by bool flags. More...
 
static constexpr uint8_t bits::ORIF8 (bool flag1, uint8_t val1, bool flag2, uint8_t val2, bool flag3, uint8_t val3, bool flag4, uint8_t val4, bool flag5, uint8_t val5, bool flag6, uint8_t val6)
 Create a uint8_t bitwise OR boolean operation between uint8_t operands, conditioned by bool flags. More...
 

Detailed Description

Useful bits manipulation utilities.

Definition in file bits.h.