xref: /illumos-gate/usr/src/tools/smatch/src/validation/backend/bitwise-ops.c (revision 8c0b080c8ed055a259d8cd26b9f005211c6a9753)
1 static int shl(int x, int y)
2 {
3 	return x << y;
4 }
5 
6 static unsigned int ushl(unsigned int x, unsigned int y)
7 {
8 	return x << y;
9 }
10 
11 static int shr(int x, int y)
12 {
13 	return x >> y;
14 }
15 
16 static unsigned int ushr(unsigned int x, unsigned int y)
17 {
18 	return x >> y;
19 }
20 
21 static int and(int x, int y)
22 {
23 	return x & y;
24 }
25 
26 static unsigned int uand(unsigned int x, unsigned int y)
27 {
28 	return x & y;
29 }
30 
31 static int or(int x, int y)
32 {
33 	return x | y;
34 }
35 
36 static unsigned int uor(unsigned int x, unsigned int y)
37 {
38 	return x | y;
39 }
40 
41 static int xor(int x, int y)
42 {
43 	return x ^ y;
44 }
45 
46 static unsigned int uxor(unsigned int x, unsigned int y)
47 {
48 	return x ^ y;
49 }
50 
51 static int not(int x)
52 {
53 	return ~x;
54 }
55 
56 static unsigned int unot(unsigned int x)
57 {
58 	return ~x;
59 }
60 
61 /*
62  * check-name: Bitwise operator code generation
63  * check-command: sparsec -c $file -o tmp.o
64  */
65