mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 15:21:02 +00:00
use roaring conventions for variable names
Roaring likes to call things "a" and "b", not "1" and "2", and use "n" for length, not "l", etcetera. Adopt these conventions to make code more readable. Also drop the 'vb' value since it isn't expensive to compute and the compiler can figure out that it can reuse the value.
This commit is contained in:
parent
9b552ab508
commit
1a8633f3a5
1 changed files with 12 additions and 13 deletions
|
|
@ -1903,25 +1903,24 @@ func intersectionCount(a, b *Container) int32 {
|
|||
|
||||
func intersectionCountArrayArray(a, b *Container) (n int32) {
|
||||
statsHit("intersectionCount/ArrayArray")
|
||||
s1, s2 := a.array, b.array
|
||||
if len(s1) == 0 || len(s2) == 0 {
|
||||
ca, cb := a.array, b.array
|
||||
na, nb := len(ca), len(cb)
|
||||
if na == 0 || nb == 0 {
|
||||
return 0
|
||||
}
|
||||
if len(s1) > len(s2) {
|
||||
s1, s2 = s2, s1
|
||||
if na > nb {
|
||||
ca, cb = cb, ca
|
||||
na, nb = nb, na
|
||||
}
|
||||
l2 := len(s2)
|
||||
i2 := 0
|
||||
v2 := s2[0]
|
||||
for _, v1 := range s1 {
|
||||
for v2 < v1 {
|
||||
i2++
|
||||
if i2 >= l2 {
|
||||
j := 0
|
||||
for _, va := range ca {
|
||||
for cb[j] < va {
|
||||
j++
|
||||
if j >= nb {
|
||||
return n
|
||||
}
|
||||
v2 = s2[i2]
|
||||
}
|
||||
if v2 == v1 {
|
||||
if cb[j] == va {
|
||||
n++
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue