fix bit map bug
This commit is contained in:
parent
e9bb654a4a
commit
871b4895f9
|
@ -50,9 +50,9 @@ const static uint8_t BIT2_MAP[4][4] = {{0b00000000, 0b00000001, 0b00000010, 0},
|
|||
|
||||
#define BIT1_SIZE(n) ((((n)-1) >> 3) + 1)
|
||||
#define BIT2_SIZE(n) ((((n)-1) >> 2) + 1)
|
||||
#define SET_BIT1(p, i, v) ((p)[(i) >> 3] &= BIT1_MAP[(i)&7][v])
|
||||
#define SET_BIT1(p, i, v) ((p)[(i) >> 3] |= BIT1_MAP[(i)&7][v])
|
||||
#define GET_BIT1(p, i) (((p)[(i) >> 3] >> ((i)&7)) & ((uint8_t)1))
|
||||
#define SET_BIT2(p, i, v) ((p)[(i) >> 2] &= BIT2_MAP[(i)&3][v])
|
||||
#define SET_BIT2(p, i, v) ((p)[(i) >> 2] |= BIT2_MAP[(i)&3][v])
|
||||
#define GET_BIT2(p, i) (((p)[(i) >> 2] >> BIT2_MAP[(i)&3][3]) & ((uint8_t)3))
|
||||
|
||||
// STSchema
|
||||
|
|
|
@ -928,6 +928,9 @@ int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
|
|||
size = BIT2_SIZE(pColData->nVal + 1);
|
||||
code = tRealloc(&pColData->pBitMap, size);
|
||||
if (code) goto _exit;
|
||||
if ((pColData->nVal & 3) == 0) {
|
||||
pColData->pBitMap[pColData->nVal >> 2] = 0;
|
||||
}
|
||||
|
||||
// put value
|
||||
if (pColVal->isNone) {
|
||||
|
|
Loading…
Reference in New Issue