mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-04 02:54:42 +08:00
support bazel complie this project and format code.
This commit is contained in:
18
basic_content/bit/bit.cpp
Normal file
18
basic_content/bit/bit.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
struct stuff {
|
||||
unsigned int field1 : 30;
|
||||
unsigned int : 2;
|
||||
unsigned int field2 : 4;
|
||||
unsigned int : 0;
|
||||
unsigned int field3 : 3;
|
||||
};
|
||||
int main() {
|
||||
struct stuff s = {1, 3, 5};
|
||||
cout << s.field1 << endl;
|
||||
cout << s.field2 << endl;
|
||||
cout << s.field3 << endl;
|
||||
cout << sizeof(s) << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user