fix(stream): coverity scan,type conversion

This commit is contained in:
54liuyao 2022-10-17 10:05:45 +08:00
parent a484fa72c5
commit 2df86022c0
1 changed files with 4 additions and 4 deletions

View File

@ -19,12 +19,12 @@
#include "taos.h" #include "taos.h"
#include "taoserror.h" #include "taoserror.h"
#define UNIT_NUM_BITS 64 #define UNIT_NUM_BITS 64ULL
#define UNIT_ADDR_NUM_BITS 6 #define UNIT_ADDR_NUM_BITS 6ULL
static FORCE_INLINE bool setBit(uint64_t *buf, uint64_t index) { static FORCE_INLINE bool setBit(uint64_t *buf, uint64_t index) {
uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS; uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS;
uint64_t mask = 1 << (index % UNIT_NUM_BITS); uint64_t mask = 1ULL << (index % UNIT_NUM_BITS);
uint64_t old = buf[unitIndex]; uint64_t old = buf[unitIndex];
buf[unitIndex] |= mask; buf[unitIndex] |= mask;
return buf[unitIndex] != old; return buf[unitIndex] != old;
@ -32,7 +32,7 @@ static FORCE_INLINE bool setBit(uint64_t *buf, uint64_t index) {
static FORCE_INLINE bool getBit(uint64_t *buf, uint64_t index) { static FORCE_INLINE bool getBit(uint64_t *buf, uint64_t index) {
uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS; uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS;
uint64_t mask = 1 << (index % UNIT_NUM_BITS); uint64_t mask = 1ULL << (index % UNIT_NUM_BITS);
return buf[unitIndex] & mask; return buf[unitIndex] & mask;
} }