LongRangeSet (LongRangeSet divisor, LongRangeType lrType) { if (divisor.isEmpty() || divisor.equals(Point.ZERO)) return empty(); divisor = divisor.meet(lrType.fullRange()); LongRangeSet dividend = this.meet(lrType.fullRange()); long[] left = splitAtZero(dividend.asRangeArray()); long[] right = splitAtZero(new long[]{divisor.min(), divisor.max()}); LongRangeSet result = empty(); for (int i = 0; i < left.length; i += 2) { for (int j = 0; j < right.length; j += 2) { result = result.join(divide(left[i], left[i + 1], right[j], right[j + 1], lrType)); } } return result; }