Skip to content

Commit

Permalink
Reduce number of calculations in FSTCompiler (#13788)
Browse files Browse the repository at this point in the history
* Simplify FST return

* Reduce number of calculations in FSTCompiler
  • Loading branch information
mrhbj authored and mikemccand committed Sep 14, 2024
1 parent b7fd00c commit 9cd6a24
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ private void freezeTail(int prefixLenPlus1) throws IOException {
for (int idx = lastInput.length(); idx >= downTo; idx--) {

final UnCompiledNode<T> node = frontier[idx];
final UnCompiledNode<T> parent = frontier[idx - 1];
final int prevIdx = idx - 1;
final UnCompiledNode<T> parent = frontier[prevIdx];

final T nextFinalOutput = node.output;

Expand All @@ -833,7 +834,7 @@ private void freezeTail(int prefixLenPlus1) throws IOException {
// this node makes it and we now compile it. first,
// compile any targets that were previously
// undecided:
parent.replaceLast(lastInput.intAt(idx - 1), compileNode(node), nextFinalOutput, isFinal);
parent.replaceLast(lastInput.intAt(prevIdx), compileNode(node), nextFinalOutput, isFinal);
}
}

Expand Down

0 comments on commit 9cd6a24

Please sign in to comment.