Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. union bit7int
  2. {
  3. struct
  4. {
  5. int iv : 7;
  6. :1;
  7. };
  8. uint8_t bv;
  9. } ;
  10.  
  11. uint8_t get7bitsInteger(int x)
  12. {
  13. struct bit7int b7i = {.bv = 0};
  14.  
  15. b7i.iv = x / (1U << (sizeof(int) - 7));
  16. return b7i.bv;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement