fork download
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. union instructionSet {
  6. struct Brane{
  7. unsigned int opcode: 4;
  8. unsigned int address: 12;
  9. } brane;
  10. struct Cmp{
  11. unsigned int opcode: 4;
  12. unsigned int blank: 1;
  13. unsigned int rsvd: 3;
  14. unsigned char letter: 8;
  15. } cmp;
  16. struct {
  17. unsigned int rsvd: 16;
  18. } reserved;
  19. };
  20.  
  21. int main() {
  22.  
  23. union instructionSet IR;// = (union instructionSet*)calloc(1, 2);
  24.  
  25. printf("size of union %ld\n", sizeof(union instructionSet));
  26. printf("size of reserved %ld\n", sizeof(IR.reserved));
  27. printf("size of brane %ld\n", sizeof(IR.brane));
  28. printf("size of brane %ld\n", sizeof(IR.cmp));
  29.  
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
size of union 4
size of reserved 4
size of brane 4
size of brane 4