Yet another bitmap implementation written in go.
$ go get -v github.com/f1monkey/bitmap
funcmain() {
varb bitmap.Bitmap64b.IsEmpty() // trueb.Set(0)
b.Has(0) // trueb.Remove(0)
b.Has(0) // falseb.Xor(1000)
b.Has(1000) // trueb.Xor(1000)
b.Has(1000) // falseb2:=b.Clone() // copy of "b"b2.Range(func(nuint32) bool {
fmt.PrintLn(n)
returntrue
})
b.Or(b2) // in-place ORb.And(b2) // in-place AND// to string, from stringvarb3 bitmap.Bitmap64b3.Set(1)
b3.Set(100)
b3.String() // "2|68719476736"b4, err:=bitmap.FromString("2|68719476736")
// Bitmap32 is backed by []uint32 slice// Everything else is all the samevarb32 bitmap.Bitmap32// Bitmap16 is backed by []uint16 slice// Everything else is all the samevarb16 bitmap.Bitmap16// Bitmap8 is backed by []uint8 slice// Everything else is all the samevarb8 bitmap.Bitmap8
}