IntersectsWithInterval checks whether a bitmap 'rb' and an open interval '[x,y)' intersect.
(x, y uint64)
| 1514 | |
| 1515 | // IntersectsWithInterval checks whether a bitmap 'rb' and an open interval '[x,y)' intersect. |
| 1516 | func (rb *Bitmap) IntersectsWithInterval(x, y uint64) bool { |
| 1517 | if x >= y { |
| 1518 | return false |
| 1519 | } |
| 1520 | if x > MaxUint32 { |
| 1521 | return false |
| 1522 | } |
| 1523 | |
| 1524 | it := intIterator{} |
| 1525 | it.Initialize(rb) |
| 1526 | it.AdvanceIfNeeded(uint32(x)) |
| 1527 | if !it.HasNext() { |
| 1528 | return false |
| 1529 | } |
| 1530 | if uint64(it.Next()) >= y { |
| 1531 | return false |
| 1532 | } |
| 1533 | |
| 1534 | return true |
| 1535 | } |
| 1536 | |
| 1537 | // Intersects checks whether two bitmap intersects, bitmaps are not modified |
| 1538 | func (rb *Bitmap) Intersects(x2 *Bitmap) bool { |