[AMDGPU][True16][CodeGen] true16 codegen pattern for f16 canonicalize (#122000)
[llvm-project.git] / lldb / test / API / lang / c / bitfields / main.c
blobba085f2aa94c2b6bb7cbd0d803953de464468bac
1 #include <stdint.h>
3 struct Bits {
4 uint32_t : 1;
5 uint32_t b1 : 1;
6 uint32_t b2 : 2;
7 uint32_t : 2;
8 uint32_t b3 : 3;
9 // Unnamed bitfield (this will get removed).
10 uint32_t : 2;
11 uint32_t b4 __attribute__ ((aligned(16)));
12 uint32_t b5 : 5;
13 uint32_t b6 : 6;
14 uint32_t b7 : 7;
15 uint32_t four : 4;
18 struct MoreBits {
19 uint32_t a : 3;
20 uint8_t : 1;
21 uint8_t b : 1;
22 uint8_t c : 1;
23 uint8_t d : 1;
25 struct MoreBits more_bits;
27 struct ManySingleBits {
28 uint16_t b1 : 1, b2 : 1, b3 : 1, b4 : 1, b5 : 1, b6 : 1, b7 : 1, b8 : 1,
29 b9 : 1, b10 : 1, b11 : 1, b12 : 1, b13 : 1, b14 : 1, b15 : 1, b16 : 1,
30 b17 : 1;
32 struct ManySingleBits many_single_bits;
34 struct LargePackedBits {
35 uint64_t a : 36;
36 uint64_t b : 36;
37 } __attribute__((packed));
39 #pragma pack(1)
40 struct PackedBits {
41 char a;
42 uint32_t b : 5, c : 27;
44 #pragma pack()
46 int main(int argc, char const *argv[]) {
47 struct Bits bits;
48 bits.b1 = 1;
49 bits.b2 = 3;
50 bits.b3 = 7;
51 bits.b4 = 15;
52 bits.b5 = 31;
53 bits.b6 = 63;
54 bits.b7 = 127;
55 bits.four = 15;
57 more_bits.a = 3;
58 more_bits.b = 0;
59 more_bits.c = 1;
60 more_bits.d = 0;
62 many_single_bits.b1 = 1;
63 many_single_bits.b5 = 1;
64 many_single_bits.b7 = 1;
65 many_single_bits.b13 = 1;
67 struct PackedBits packed;
68 packed.a = 'a';
69 packed.b = 10;
70 packed.c = 0x7112233;
72 struct LargePackedBits large_packed =
73 (struct LargePackedBits){0xcbbbbaaaa, 0xdffffeeee};
74 struct LargePackedBits *large_packed_ptr = &large_packed;
76 return 0; // break here