private static LongRangeSet fromBits(BitString bits) {
    if (bits.myMask == -1) {
      return point(bits.myBits);
    }
    long from = 0;
    int i = Long.SIZE - 1;
    while (i >= 0 && bits.get(i) != ThreeState.UNSURE) {
      if (bits.get(i) == ThreeState.YES) {
        from = setBit(from, i);
      }
      i--;
    }
    long to = ((i == Long.SIZE - 1 ? 0 : 1L << (i + 1)) - 1) | from;
    int j = 0;
    while(j < i && bits.get(j) != ThreeState.UNSURE) {
      if (bits.get(j) == ThreeState.NO) {
        to = clearBit(to, j);
      }
      j++;
    }
    if(i == j) {
      // exactly one 'unsure' bit = exactly two points (with unsure bit = 0 and unsure bit = 1)
      return point(bits.myBits & bits.myMask).join(point((bits.myBits | (~bits.myMask))));
    }
    long modBits = -1;
    for (int rem = 0; rem < Long.SIZE; rem++) {
      for (int pos = 0; pos < 6; pos++) {
        ThreeState bit = bits.get(pos);
        if (bit == ThreeState.fromBoolean(!isSet(rem, pos))) {
          modBits = clearBit(modBits, rem);
          break;
        }
      }
    }
    if (from >= 0 && to < 0) {
      from = Long.MIN_VALUE;
      to = Long.MAX_VALUE;
    }
    return from < to ? modRange(from, to, Long.SIZE, modBits) : modRange(to, from, Long.SIZE, modBits);
  }
private static LongRangeSet fromBits(BitString bits)