提交 5b83fcc1 编写于 作者: H Hongze Cheng

optimize by interpolation search

上级 644bba8e
...@@ -1097,7 +1097,8 @@ void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColD ...@@ -1097,7 +1097,8 @@ void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColD
int32_t ridx = pBlockData->nColData - 1; int32_t ridx = pBlockData->nColData - 1;
while (lidx <= ridx) { while (lidx <= ridx) {
int32_t midx = (lidx + ridx) >> 2; int32_t midx = lidx + (ridx - lidx) * (cid - pBlockData->aColData[lidx].cid) /
(pBlockData->aColData[ridx].cid - pBlockData->aColData[lidx].cid);
SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, midx); SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, midx);
int32_t c = (pColData->cid == cid) ? 0 : ((pColData->cid > cid) ? 1 : -1); int32_t c = (pColData->cid == cid) ? 0 : ((pColData->cid > cid) ? 1 : -1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册