Comments (2)
This and other functions are now available in https://github.com/chippyash/logicgate
from bitmap.
@aep It seemed a bit strange to me at first, but if you understand the original use case, it kind makes sense. Here's a function that will range over all the bits if you need it.
// RangeAll iterates over all the bits in the bitmap.
// For the rare instances where bitmap.Range is insufficient
func RangeAll(src bitmap.Bitmap, fn func(k uint32, v bool)) {
l := uint32(len(src))
for blkAt := uint32(0); blkAt < l; blkAt++ {
blk := src[blkAt]
bit := uint64(0x1)
for bitAt := uint32(0); bitAt < 64; bitAt++ {
k := blkAt*64 + bitAt
v := (blk & bit) != 0
fn(k, v)
bit <<= 1
}
}
}
from bitmap.
Related Issues (13)
- Give credit to the original author? HOT 1
- sync.Pool usage HOT 1
- AVX2. And operation produce wrong result when bitmaps have different sizes
- AVX2. And operation produce wrong result when bitmaps have different sizes. V2 HOT 2
- FromBytes() has bug about length of buffer
- Kelindar fails under highload. 1-3/400k requests HOT 2
- support `not` operation HOT 2
- No benefit with new bulk approach for `And` ? HOT 1
- syntax error
- Bitmap.Or(shortBitmap, longBitmap) result length same as the first one
- Virtual memory leak while using bitmap
- Why uint64 instead of byte?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitmap.