some bug fix

This commit is contained in:
tursom 2023-04-25 17:37:51 +08:00
parent 6527759d1e
commit 5f6a994c48
3 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,7 @@ func (b *Bloom) Contains(data []byte) bool {
}
func (b *Bloom) Add(data []byte) {
b.hashCode = 0
b.c++
for i := 0; i < int(b.k); i++ {
hashCode := uint(HashFunc(data, uint32(i)))
@ -142,6 +143,7 @@ func (b *Bloom) Merge(t *Bloom) bool {
return false
}
b.hashCode = 0
for i := range b.m {
b.m[i] |= t.m[i]
}
@ -154,6 +156,7 @@ func (b *Bloom) MergeBM(bitMap []byte) bool {
return false
}
b.hashCode = 0
for i := range b.m {
b.m[i] |= lang.UInt8(bitMap[i])
}

1
util/curry/curry.go Normal file
View File

@ -0,0 +1 @@
package curry

View File

@ -36,6 +36,7 @@ func MultiMap[V, R any](values <-chan V, m func(value V) R) <-chan R {
c := atomic.Int32(1)
for value0 := range values {
c.Add(1)
value := value0
go func() {
rc <- m(value)