Macros to make bit manipulation easier.
More...
Go to the source code of this file.
|
#define | bit_get(p, m) ((p) & (0x01 << m)) |
|
#define | bit_set(p, m) ((p) |= (0x01 << m)) |
|
#define | bit_clear(p, m) ((p) &= ~(0x01 << m)) |
|
#define | bit_flip(p, m) ((p) ^= (0x01 << m)) |
|
#define | BIT(x) (0x01 << (x)) |
|
Macros to make bit manipulation easier.
- Author
- Benjamin Pritchard (ben@b.nosp@m.enny.nosp@m.p.org)
- Copyright
- 2013 Benjamin Pritchard. Released under the MIT License
Definition in file bits.h.
#define BIT |
( |
|
x) | |
(0x01 << (x)) |
Convert a bit position to a bit
Definition at line 23 of file bits.h.
#define bit_clear |
( |
|
p, |
|
|
|
m |
|
) |
| ((p) &= ~(0x01 << m)) |
Clear bit m in register p
Definition at line 17 of file bits.h.
#define bit_flip |
( |
|
p, |
|
|
|
m |
|
) |
| ((p) ^= (0x01 << m)) |
Flip or toggle bit m in register p
Definition at line 20 of file bits.h.
#define bit_get |
( |
|
p, |
|
|
|
m |
|
) |
| ((p) & (0x01 << m)) |
Get bit m in register p
Definition at line 11 of file bits.h.
#define bit_set |
( |
|
p, |
|
|
|
m |
|
) |
| ((p) |= (0x01 << m)) |
Set bit m in register p
Definition at line 14 of file bits.h.