From 7e20d14f325abfe833e9165d917ce08ea65a6472 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 9 Feb 2022 10:58:02 +0800 Subject: [PATCH] [td-11818] Opt perf. --- include/common/tep.h | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/include/common/tep.h b/include/common/tep.h index b432a75b6a..2c85f9d3a0 100644 --- a/include/common/tep.h +++ b/include/common/tep.h @@ -27,12 +27,10 @@ bool isEpsetEqual(const SEpSet *s1, const SEpSet *s2); void updateEpSet_s(SCorEpSet *pEpSet, SEpSet *pNewEpSet); SEpSet getEpSet_s(SCorEpSet *pEpSet); -#define BitPos(_n) ((_n) & ((1<>3u] & (1u<<(7u - BitPos(row)))) == (1u<<(7u - BitPos(row))); -} +#define BitPos(_n) ((_n) & ((1 << NBIT) - 1)) +#define BMCharPos(bm_, r_) (bm_)[(r_) >> NBIT] +#define colDataIsNull_f(bm_, r_) (BMCharPos(bm_, r_) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))) void colDataSetNull_f(char* bitmap, uint32_t row); @@ -62,14 +60,9 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u } } -static FORCE_INLINE char* colDataGet(SColumnInfoData* pColumnInfoData, uint32_t row) { - char* p = pColumnInfoData->pData; - if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { - return p + pColumnInfoData->varmeta.offset[row]; - } else { - return p + (row * pColumnInfoData->info.bytes); - } -} +#define colDataGet(p1_, r_) \ + ((IS_VAR_DATA_TYPE((p1_)->info.type)) ? (p1_)->pData + (p1_)->varmeta.offset[(r_)] \ + : (p1_)->pData + ((r_) * (p1_)->info.bytes)); int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull); int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, const SColumnInfoData* pSource, uint32_t numOfRow2);