typedefine.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef __TYPEDEFINE_H__
  2. #define __TYPEDEFINE_H__
  3. typedef union {
  4. struct
  5. {
  6. unsigned char b0:1;
  7. unsigned char b1:1;
  8. unsigned char b2:1;
  9. unsigned char b3:1;
  10. unsigned char b4:1;
  11. unsigned char b5:1;
  12. unsigned char b6:1;
  13. unsigned char b7:1;
  14. }bits;
  15. unsigned char value;
  16. unsigned char bytes[1];
  17. } byte_bits_t;
  18. typedef union {
  19. struct
  20. {
  21. unsigned char b0:1;
  22. unsigned char b1:1;
  23. unsigned char b2:1;
  24. unsigned char b3:1;
  25. unsigned char b4:1;
  26. unsigned char b5:1;
  27. unsigned char b6:1;
  28. unsigned char b7:1;
  29. unsigned char b8:1;
  30. unsigned char b9:1;
  31. unsigned char b10:1;
  32. unsigned char b11:1;
  33. unsigned char b12:1;
  34. unsigned char b13:1;
  35. unsigned char b14:1;
  36. unsigned char b15:1;
  37. } bits;
  38. unsigned short value;
  39. unsigned char bytes[2];
  40. } word_bits_t;
  41. typedef union {
  42. struct
  43. {
  44. unsigned char b0:1;
  45. unsigned char b1:1;
  46. unsigned char b2:1;
  47. unsigned char b3:1;
  48. unsigned char b4:1;
  49. unsigned char b5:1;
  50. unsigned char b6:1;
  51. unsigned char b7:1;
  52. unsigned char b8:1;
  53. unsigned char b9:1;
  54. unsigned char b10:1;
  55. unsigned char b11:1;
  56. unsigned char b12:1;
  57. unsigned char b13:1;
  58. unsigned char b14:1;
  59. unsigned char b15:1;
  60. unsigned char b16:1;
  61. unsigned char b17:1;
  62. unsigned char b18:1;
  63. unsigned char b19:1;
  64. unsigned char b20:1;
  65. unsigned char b21:1;
  66. unsigned char b22:1;
  67. unsigned char b23:1;
  68. unsigned char b24:1;
  69. unsigned char b25:1;
  70. unsigned char b26:1;
  71. unsigned char b27:1;
  72. unsigned char b28:1;
  73. unsigned char b29:1;
  74. unsigned char b30:1;
  75. unsigned char b31:1;
  76. } bits;
  77. unsigned int value;
  78. unsigned char bytes[4];
  79. } dword_bits_t;
  80. //#define NULL (void *)0
  81. #endif