2961
|
1 #ifndef BITS_H
|
|
2 #define BITS_H
|
|
3
|
|
4 #define BIT(n) (1<<(n))
|
|
5
|
|
6 #define BIT_N(i,n) (((i)>>(n))&1)
|
|
7 #define BIT0(i) ((i)&1)
|
|
8 #define BIT1(i) BIT_N(i,1)
|
|
9 #define BIT2(i) BIT_N(i,2)
|
|
10 #define BIT3(i) BIT_N(i,3)
|
|
11 #define BIT4(i) BIT_N(i,4)
|
|
12 #define BIT5(i) BIT_N(i,5)
|
|
13 #define BIT6(i) BIT_N(i,6)
|
|
14 #define BIT7(i) BIT_N(i,7)
|
|
15 #define BIT8(i) BIT_N(i,8)
|
|
16 #define BIT9(i) BIT_N(i,9)
|
|
17 #define BIT10(i) BIT_N(i,10)
|
|
18 #define BIT11(i) BIT_N(i,11)
|
|
19 #define BIT12(i) BIT_N(i,12)
|
|
20 #define BIT13(i) BIT_N(i,13)
|
|
21 #define BIT14(i) BIT_N(i,14)
|
|
22 #define BIT15(i) BIT_N(i,15)
|
|
23 #define BIT16(i) BIT_N(i,16)
|
|
24 #define BIT17(i) BIT_N(i,17)
|
|
25 #define BIT18(i) BIT_N(i,18)
|
|
26 #define BIT19(i) BIT_N(i,19)
|
|
27 #define BIT20(i) BIT_N(i,20)
|
|
28 #define BIT21(i) BIT_N(i,21)
|
|
29 #define BIT22(i) BIT_N(i,22)
|
|
30 #define BIT23(i) BIT_N(i,23)
|
|
31 #define BIT24(i) BIT_N(i,24)
|
|
32 #define BIT25(i) BIT_N(i,25)
|
|
33 #define BIT26(i) BIT_N(i,26)
|
|
34 #define BIT27(i) BIT_N(i,27)
|
|
35 #define BIT28(i) BIT_N(i,28)
|
|
36 #define BIT29(i) BIT_N(i,29)
|
|
37 #define BIT30(i) BIT_N(i,30)
|
|
38 #define BIT31(i) ((i)>>31)
|
|
39
|
|
40 #define CONDITION(i) (i)>>28
|
|
41
|
|
42 #define REG_POS(i,n) (((i)>>n)&0xF)
|
|
43
|
|
44 #endif
|