fork(2) download
  1. #include <cstdio>
  2.  
  3. struct test16 {
  4. unsigned short x:12;
  5. unsigned short y:12;
  6. };
  7.  
  8. struct test32 {
  9. unsigned x:12;
  10. unsigned y:12;
  11. };
  12.  
  13. int main() {
  14. test16 t16; t16.x=0xABC; t16.y=0xDEF;
  15. test32 t32; t32.x=0x123; t32.y=0x456;
  16.  
  17. printf("%u %u\n", sizeof (test16), sizeof (test32));
  18. printf("%0.3X %0.3X %0.8X\n", t16.x, t16.y, t16);
  19. printf("%0.3X %0.3X %0.8X\n", t32.x, t32.y, t32);
  20. return 0;
  21. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
4 4
ABC DEF 0DEF0ABC
123 456 00456123