I am currently looking into #1116 (ferry speeds). In the AbstractFlagEncoder we check a couple of times if the speed we are trying to store for an edge is smaller than the speed we can store in the speedEncoder. We do this with this check:
speed < speedEncoder.factor / 2
Right now I wonder where the
/ 2 comes from. To clarify the
/ 2 is not wrong, but why don’t we simply check if the
speed < speedEncoder.factor?
When reading a value from the flags in the EncodedDoubleValue, we do this:
flags &= mask;
flags >>>= shift;
return flags * factor;
Which means that we cannot store anything smaller than the factor (excluding 0, obviously).
Do I miss something?