Skip to content

Commit

Permalink
Merge pull request #145 from maciej/inline-bc-lazyior-run
Browse files Browse the repository at this point in the history
Manually inline setBitmapRange to *bitmapContainer.lazyIOR function
  • Loading branch information
lemire authored Feb 6, 2018
2 parents c89f23b + 92fd9d9 commit 5799591
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions bitmapcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,28 @@ func (bc *bitmapContainer) lazyIOR(a container) container {
if x.isFull() {
return x.clone()
}
// TODO : implement efficient in-place lazy OR to bitmap
for i := range x.iv {
setBitmapRange(bc.bitmap, int(x.iv[i].start), int(x.iv[i].last())+1)
//bc.iaddRange(int(x.iv[i].start), int(x.iv[i].last)+1)

// Manually inlined setBitmapRange function
bitmap := bc.bitmap
for _, iv := range x.iv {
start := int(iv.start)
end := int(iv.last()) + 1
if start >= end {
continue
}
firstword := start / 64
endword := (end - 1) / 64
if firstword == endword {
bitmap[firstword] |= (^uint64(0) << uint(start%64)) & (^uint64(0) >> (uint(-end) % 64))
continue
}
bitmap[firstword] |= ^uint64(0) << uint(start%64)
for i := firstword + 1; i < endword; i++ {
bitmap[i] = ^uint64(0)
}
bitmap[endword] |= ^uint64(0) >> (uint(-end) % 64)
}
bc.cardinality = invalidCardinality
//bc.computeCardinality()
return bc
}
panic("unsupported container type")
Expand Down

0 comments on commit 5799591

Please sign in to comment.