This source file includes following definitions.
- getBit
- clearBitAtPos
- setBitAtPos
1
2
3
4
5
6
7
8
9 #ifndef _BITFUNCS_H
10 #define _BITFUNCS_H
11
12 #define SetBit(Bit) (1 << Bit)
13
14 static inline u8 getBit(u32 sample, u8 index)
15 {
16 return (u8) ((sample >> index) & 1);
17 }
18
19 static inline u32 clearBitAtPos(u32 value, u8 bit)
20 {
21 return value & ~(1 << bit);
22 }
23
24 static inline u32 setBitAtPos(u32 sample, u8 bit)
25 {
26 sample |= (1 << bit);
27 return sample;
28
29 }
30
31 #endif