Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damnever/bitarray
BitArray for Golang
https://github.com/damnever/bitarray
bitarray golang hamming-weight
Last synced: about 1 month ago
JSON representation
BitArray for Golang
- Host: GitHub
- URL: https://github.com/damnever/bitarray
- Owner: damnever
- License: other
- Created: 2016-09-23T17:25:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-23T12:22:03.000Z (over 5 years ago)
- Last Synced: 2024-10-03T18:46:32.110Z (about 1 month ago)
- Topics: bitarray, golang, hamming-weight
- Language: Go
- Homepage: https://github.com/damnever/bitarray
- Size: 8.79 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## BitArray for Golang [![Build Status](https://travis-ci.org/damnever/bitarray.svg?branch=master)](https://travis-ci.org/damnever/bitarray) [![GoDoc](https://godoc.org/github.com/damnever/bitarray?status.svg)](https://godoc.org/github.com/damnever/bitarray)
### Installation
```
go get github.com/damnever/bitarray
```### Example
```go
package mainimport "github.com/damnever/bitarray"
func main() {
bits := bitarray.New(64)bits.Put(8, 1) // set value of the bit to 1 by index 8, return old bit.
bits.Get(8) // get value of the bit by index 8
bits.Set(9, 16) // set all bits to 1 between 9 and 16 , both 9 and 16 included.
bits.Count() // get the count of bit 1
// Clear/Not/Eq/Leq/Lt/ToArray ...
}
```