[td-6563]
This commit is contained in:
parent
616f32e018
commit
ad0b62328c
|
@ -34,7 +34,6 @@ typedef struct SLoserTreeInfo {
|
|||
int32_t totalEntries;
|
||||
__merge_compare_fn_t comparFn;
|
||||
void * param;
|
||||
|
||||
SLoserTreeNode *pNode;
|
||||
} SLoserTreeInfo;
|
||||
|
||||
|
|
|
@ -90,12 +90,13 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
|
|||
SLoserTreeNode kLeaf = pTree->pNode[idx];
|
||||
|
||||
while (parentId > 0) {
|
||||
if (pTree->pNode[parentId].index == -1) {
|
||||
SLoserTreeNode* pCur = &pTree->pNode[parentId];
|
||||
if (pCur->index == -1) {
|
||||
pTree->pNode[parentId] = kLeaf;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t ret = pTree->comparFn(&pTree->pNode[parentId], &kLeaf, pTree->param);
|
||||
int32_t ret = pTree->comparFn(pCur, &kLeaf, pTree->param);
|
||||
if (ret < 0) {
|
||||
SLoserTreeNode t = pTree->pNode[parentId];
|
||||
pTree->pNode[parentId] = kLeaf;
|
||||
|
|
Loading…
Reference in New Issue