31 static const int SIZE = BYTES;
48 static_assert(std::is_pod<
BitPack<32>>::value,
"BitPack must be a POD type");
63 const char *cdata =
static_cast<const char*
>(
bdata);
65 lReturnValue.u = (*(
MR_UInt32 *) (cdata + pOffset / 8)) >> (pOffset % 8);
67 if((pLen + (pOffset % 8)) > 32) {
68 lReturnValue.u |= (*(
MR_UInt32 *) (cdata + (pOffset / 8) + 4)) << (32 - (pOffset % 8));
71 lReturnValue.s = lReturnValue.s << (32 - pLen) >> (32 - pLen);
73 return lReturnValue.s << pPrecision;
81 const char *cdata =
static_cast<const char*
>(
bdata);
83 lReturnValue = (*(
MR_UInt32 *) (cdata + pOffset / 8)) >> (pOffset % 8);
85 if(pLen + (pOffset % 8) > 32) {
86 lReturnValue |= (*(
MR_UInt32 *) (cdata + (pOffset / 8) + 4)) << (32 - (pOffset % 8));
89 lReturnValue = lReturnValue << (32 - pLen) >> (32 - pLen);
91 return lReturnValue << pPrecision;
103 char *cdata =
static_cast<char*
>(
bdata);
110 conv.s = pValue >> pPrecision;
113 lValue = lValue << (32 - pLen) >> (32 - pLen);
115 (*(
MR_UInt32 *) (cdata + pOffset / 8)) |= lValue << (pOffset % 8);
117 if((pLen + (pOffset % 8)) > 32) {
118 (*(
MR_UInt32 *) (cdata + (pOffset / 8) + 4)) |= lValue >> (32 - (pOffset % 8));
125 char *cdata =
static_cast<char*
>(
bdata);
129 lValue = lValue << (32 - pLen) >> (32 - pLen);
131 (*(
MR_UInt32 *) (cdata + pOffset / 8)) |= lValue << (pOffset % 8);
133 if((pLen + (pOffset % 8)) > 32) {
134 (*(
MR_UInt32 *) (cdata + (pOffset / 8) + 4)) |= lValue >> (32 - (pOffset % 8));
char bdata[REALSIZE]
Definition: BitPacking.h:36
void InitFrom(const MR_UInt8 *data)
Definition: BitPacking.h:51
void Clear()
Definition: BitPacking.h:95
void Set(MR_UInt32 pOffset, MR_UInt32 pLen, MR_UInt32 pPrecision, MR_Int32 pValue)
Definition: BitPacking.h:101
int32_t MR_Int32
Definition: MR_Types.h:43
static const int SIZE
Definition: BitPacking.h:31
Definition: BitPacking.h:30
static const int REALSIZE
Definition: BitPacking.h:35
MR_Int32 Get(MR_UInt32 pOffset, MR_UInt32 pLen, MR_UInt32 pPrecision) const
Definition: BitPacking.h:56
Definition: Announcement.h:24
uint32_t MR_UInt32
Definition: MR_Types.h:44
MR_UInt32 Getu(MR_UInt32 pOffset, MR_UInt32 pLen, MR_UInt32 pPrecision) const
Definition: BitPacking.h:77
uint8_t MR_UInt8
Definition: MR_Types.h:40