Speeduino
Loading...
Searching...
No Matches
bit_manip.h
Go to the documentation of this file.
1#pragma once
2
9#define BIT_SET(var,pos) ((var) |= (1U<<(pos)))
10
12#define BIT_CLEAR(var,pos) ((var) &= ~(1U<<(pos)))
13
15#define BIT_CHECK(var,pos) !!((var) & (1U<<(pos)))
16
18#define BIT_TOGGLE(var,pos) ((var)^= 1UL << (pos))
19
21#define BIT_WRITE(var, pos, bitvalue) ((bitvalue) ? BIT_SET((var), (pos)) : BIT_CLEAR((var), (pos)))