1*8f6c61bcSshadow303 #ifndef BENDIAN_BITFIELD_H 2*8f6c61bcSshadow303 #define BENDIAN_BITFIELD_H 3*8f6c61bcSshadow303 4*8f6c61bcSshadow303 #include <ByteOrder.h> 5*8f6c61bcSshadow303 6*8f6c61bcSshadow303 #if B_HOST_IS_LENDIAN 7*8f6c61bcSshadow303 8*8f6c61bcSshadow303 #define BBITFIELD8_2(b1,b2) uint8 b2,b1 9*8f6c61bcSshadow303 #define BBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1 10*8f6c61bcSshadow303 #define BBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1 11*8f6c61bcSshadow303 #define BBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1 12*8f6c61bcSshadow303 #define BBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1 13*8f6c61bcSshadow303 #define BBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1 14*8f6c61bcSshadow303 #define BBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1 15*8f6c61bcSshadow303 16*8f6c61bcSshadow303 17*8f6c61bcSshadow303 #define BBITFIELD16_2(b1,b2) uint16 b2,b1 18*8f6c61bcSshadow303 #define BBITFIELD16_3(b1,b2,b3) uint16 b3,b2,b1 19*8f6c61bcSshadow303 #define BBITFIELD16_4(b1,b2,b3,b4) uint16 b4,b3,b2,b1 20*8f6c61bcSshadow303 #define BBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1 21*8f6c61bcSshadow303 #define BBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1 22*8f6c61bcSshadow303 #define BBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1 23*8f6c61bcSshadow303 #define BBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1 24*8f6c61bcSshadow303 #define BBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1 25*8f6c61bcSshadow303 #define BBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 26*8f6c61bcSshadow303 #define BBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 27*8f6c61bcSshadow303 #define BBITFIELD16_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 28*8f6c61bcSshadow303 #define BBITFIELD16_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 29*8f6c61bcSshadow303 #define BBITFIELD16_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 30*8f6c61bcSshadow303 #define BBITFIELD16_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 31*8f6c61bcSshadow303 #define BBITFIELD16_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 32*8f6c61bcSshadow303 #elif B_HOST_IS_BENDIAN 33*8f6c61bcSshadow303 34*8f6c61bcSshadow303 #define BBITFIELD8_2(b1,b2) uint8 b1,b2 35*8f6c61bcSshadow303 #define BBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3 36*8f6c61bcSshadow303 #define BBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4 37*8f6c61bcSshadow303 #define BBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5 38*8f6c61bcSshadow303 #define BBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6 39*8f6c61bcSshadow303 #define BBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7 40*8f6c61bcSshadow303 #define BBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8 41*8f6c61bcSshadow303 42*8f6c61bcSshadow303 #define BBITFIELD16_2(b1,b2) uint16 b1,b2 43*8f6c61bcSshadow303 #define BBITFIELD16_3(b1,b2,b3) uint16 b1,b2,b3 44*8f6c61bcSshadow303 #define BBITFIELD16_4(b1,b2,b3,b4) uint16 b1,b2,b3,b4 45*8f6c61bcSshadow303 #define BBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5 46*8f6c61bcSshadow303 #define BBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6 47*8f6c61bcSshadow303 #define BBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7 48*8f6c61bcSshadow303 #define BBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8 49*8f6c61bcSshadow303 #define BBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9 50*8f6c61bcSshadow303 #define BBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 51*8f6c61bcSshadow303 #define BBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11 52*8f6c61bcSshadow303 #define BBITFIELD16_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12 53*8f6c61bcSshadow303 #define BBITFIELD16_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 54*8f6c61bcSshadow303 #define BBITFIELD16_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14 55*8f6c61bcSshadow303 #define BBITFIELD16_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15 56*8f6c61bcSshadow303 #define BBITFIELD16_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16 57*8f6c61bcSshadow303 58*8f6c61bcSshadow303 #else 59*8f6c61bcSshadow303 #error "Unknown host endianness" 60*8f6c61bcSshadow303 #endif 61*8f6c61bcSshadow303 62*8f6c61bcSshadow303 #endif /* BENDIAN_BITFIELD_H */ 63