Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- union bit7int
- {
- struct
- {
- int iv : 7;
- :1;
- };
- uint8_t bv;
- } ;
- uint8_t get7bitsInteger(int x)
- {
- struct bit7int b7i = {.bv = 0};
- b7i.iv = x / (1U << (sizeof(int) - 7));
- return b7i.bv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement