https://github.com/aermolaev/bitarray
A bit array is an array data structure that compactly stores bits.
https://github.com/aermolaev/bitarray
bit bitarray concurency go golang
Last synced: 3 months ago
JSON representation
A bit array is an array data structure that compactly stores bits.
- Host: GitHub
- URL: https://github.com/aermolaev/bitarray
- Owner: aermolaev
- License: mit
- Created: 2020-05-27T10:31:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T10:41:40.000Z (about 5 years ago)
- Last Synced: 2025-01-23T22:49:29.047Z (5 months ago)
- Topics: bit, bitarray, concurency, go, golang
- Language: Go
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BitArray
A bit array (also known as bit map, bit set, bit string, or bit vector)
is an array data structure that compactly stores bits.## Installation
go get github.com/aermolaev/bitarray
## Simple Example
```go
package mainimport (
"fmt""github.com/aermolaev/bitarray"
)func main() {
b := bitarray.NewBitArray(1_000_000)b.Mark(4000)
fmt.Println(b.Get(4000)) // trueb.Unmark(4000)
fmt.Println(b.Get(4000)) // falsei := b.MarkFree() // 0
fmt.Println(i) // true
fmt.Println(b.Get(i)) // true
fmt.Println(b.IsEmpty()) // false
fmt.Println(b.HasRoom()) // true
}
```