mikemccand commented on code in PR #12633:
URL: https://github.com/apache/lucene/pull/12633#discussion_r1365589420
##########
lucene/core/src/java/org/apache/lucene/util/fst/FST.java:
##########
@@ -827,18 +826,21 @@ int readNextArcLabel(Arc<T> arc, BytesReader in) throws
IOException {
if (arc.bytesPerArc() != 0) {
// System.out.println(" nextArc real array");
// Arcs have fixed length.
- if (arc.nodeFlags() == ARCS_FOR_BINARY_SEARCH) {
- // Point to next arc, -1 to skip arc flags.
- in.setPosition(arc.posArcsStart() - (1 + arc.arcIdx()) * (long)
arc.bytesPerArc() - 1);
- } else {
- assert arc.nodeFlags() == ARCS_FOR_DIRECT_ADDRESSING;
- // Direct addressing node. The label is not stored but rather
inferred
- // based on first label and arc index in the range.
- assert BitTable.assertIsValid(arc, in);
- assert BitTable.isBitSet(arc.arcIdx(), arc, in);
- int nextIndex = BitTable.nextBitSet(arc.arcIdx(), arc, in);
- assert nextIndex != -1;
- return arc.firstLabel() + nextIndex;
+ switch (arc.nodeFlags()) {
+ case ARCS_FOR_BINARY_SEARCH:
+ // Point to next arc, -1 to skip arc flags.
+ in.setPosition(arc.posArcsStart() - (1 + arc.arcIdx()) * (long)
arc.bytesPerArc() - 1);
+ break;
+ case ARCS_FOR_DIRECT_ADDRESSING:
+ // Direct addressing node. The label is not stored but rather
inferred
+ // based on first label and arc index in the range.
+ assert BitTable.assertIsValid(arc, in);
+ assert BitTable.isBitSet(arc.arcIdx(), arc, in);
+ int nextIndex = BitTable.nextBitSet(arc.arcIdx(), arc, in);
+ assert nextIndex != -1;
+ return arc.firstLabel() + nextIndex;
+ default:
Review Comment:
Ahh you mean remove the outer `if` around this switch right? I like it!
I'll do that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]