2 docCopyright("Steve Dekorte", 2004)
3 docLicense("BSD revised") *
6 #include "BStreamTag.h"
10 unsigned int isArray : 1;
11 unsigned int type : 2;
12 unsigned int byteCount : 5;
15 BStreamTag
BStreamTag_FromUnsignedChar(unsigned char c
)
17 // we need to do this because bit fields are compiler dependent
20 t
.type
= ( c
<< 1) >> 6;
21 t
.byteCount
= ( c
<< 3 ) >> 3;
25 unsigned char BStreamTag_asUnsignedChar(BStreamTag
*self
)
29 c
= c
| t
.isArray
<< 7;
35 // -----------------------------------------------------
37 BStreamTag
BStreamTag_TagArray_type_byteCount_(unsigned int a
, unsigned int t
, unsigned int b
)
46 int BStreamTag_isEqual_(BStreamTag
*self
, BStreamTag
*other
)
48 return (BStreamTag_asUnsignedChar(self
) == BStreamTag_asUnsignedChar(other
));
51 void BStreamTag_print(BStreamTag
*self
)
54 printf("isArray: %i ", self
->isArray
);
55 printf("type: %i ", self
->type
);
56 printf("byteCount: %i", self
->byteCount
);
60 char *BStreamTag_typeName(BStreamTag
*self
)
64 case BSTREAM_UNSIGNED_INT
:
66 case BSTREAM_SIGNED_INT
:
74 return "UNKNOWN TYPE";