def intersects()

in algebird-core/src/main/scala/com/twitter/algebird/immutable/BitSet.scala [628:655]


    def intersects(rhs: BitSet): Boolean =
      if (height > rhs.height) {
        if (rhs.offset < offset || limit <= rhs.offset) {
          false
        } else {
          // this branch contains rhs, so find its index
          val i = index(rhs.offset)
          val c0 = children(i)
          if (c0 != null) c0.intersects(rhs) else false
        }
      } else if (height < rhs.height) {
        // use commuativity to handle this in previous case
        rhs.intersects(this)
      } else if (offset != rhs.offset) {
        // same height, but non-overlapping
        false
      } else {
        // height == rhs.height, so we know rhs is a Branch.
        val Branch(_, _, rcs) = rhs
        var i = 0
        while (i < 32) {
          val x = children(i)
          val y = rcs(i)
          if (x != null && y != null && (x.intersects(y))) return true
          i += 1
        }
        false
      }