An open API service indexing awesome lists of open source software.

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.

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 main

import (
"fmt"

"github.com/aermolaev/bitarray"
)

func main() {
b := bitarray.NewBitArray(1_000_000)

b.Mark(4000)
fmt.Println(b.Get(4000)) // true

b.Unmark(4000)
fmt.Println(b.Get(4000)) // false

i := b.MarkFree() // 0
fmt.Println(i) // true
fmt.Println(b.Get(i)) // true
fmt.Println(b.IsEmpty()) // false
fmt.Println(b.HasRoom()) // true
}
```