LongRangeSet (LongRangeSet other, LongRangeType lrType) { LongRangeSet set = super.plus(other, lrType); if (other instanceof Point || other instanceof ModRange && ((ModRange)other).myMod == myMod && Long.bitCount(((ModRange)other).myBits) == 1) { long[] ranges = set.asRangeArray(); LongRangeSet result = empty(); int bit = other instanceof Point ? remainder(((Point)other).myValue, myMod) : Long.numberOfTrailingZeros(((ModRange)other).myBits); long bits = rotateRemainders(myBits, myMod, myMod - bit); for (int i = 0; i < ranges.length; i += 2) { LongRangeSet plus; if (Integer.bitCount(myMod) == 1 || !additionMayOverflow(other, lrType)) { plus = modRange(ranges[i], ranges[i + 1], myMod, bits); } else { plus = range(ranges[i], ranges[i + 1]); } result = result.join(plus); } return result; } return set; }