Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookup 方法 nextStart 计算疑问 #68

Open
tonyzhou1890 opened this issue Dec 6, 2021 · 0 comments
Open

lookup 方法 nextStart 计算疑问 #68

tonyzhou1890 opened this issue Dec 6, 2021 · 0 comments

Comments

@tonyzhou1890
Copy link

    const i = record.idx;
    const list = record.list;
    const rid = this._reduceRecordBlock(list[i].recordStartOffset);
    const nextStart =
      i + 1 >= list.length
        ? this._recordBlockStartOffset +
          this.recordBlockInfoList[this.recordBlockInfoList.length - 1]
            .decompAccumulator +
          this.recordBlockInfoList[this.recordBlockInfoList.length - 1]
            .decompSize
        : list[i + 1].recordStartOffset;

list 是当前块的单词列表,但当最后一个单词的时候,偏移值却是根据最后一个 block 计算的。虽然最后查询结果没问题——_decodeRecordBlockByRBID 是截取的当前块的数据,就算 nextStart 超出也没关系。
不确定 nextStart 的计算是否是有意这么写的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant