AddMany add all of the values in dat
(dat []uint64)
| 959 | |
| 960 | // AddMany add all of the values in dat |
| 961 | func (rb *Bitmap) AddMany(dat []uint64) { |
| 962 | if len(dat) == 0 { |
| 963 | return |
| 964 | } |
| 965 | |
| 966 | start, batchHighBits := 0, highbits(dat[0]) |
| 967 | for end := 1; end < len(dat); end++ { |
| 968 | hi := highbits(dat[end]) |
| 969 | if hi != batchHighBits { |
| 970 | batch := make([]uint32, end-start) |
| 971 | for i := 0; i < end-start; i++ { |
| 972 | batch[i] = lowbits(dat[start+i]) |
| 973 | } |
| 974 | rb.getOrCreateContainer(batchHighBits).AddMany(batch) |
| 975 | |
| 976 | batchHighBits = hi |
| 977 | start = end |
| 978 | } |
| 979 | } |
| 980 | |
| 981 | batch := make([]uint32, len(dat)-start) |
| 982 | for i := 0; i < len(dat)-start; i++ { |
| 983 | batch[i] = lowbits(dat[start+i]) |
| 984 | } |
| 985 | rb.getOrCreateContainer(batchHighBits).AddMany(batch) |
| 986 | } |
| 987 | |
| 988 | // getOrCreateContainer gets the roaring.Bitmap for key hb, |
| 989 | // or creates an *empty* roaring.Bitmap, inserts it to rb.highlowcontainer, and returns the new roaring.Bitmap. |