bitutil

package
v0.0.0-...-c85edb6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitLength

func BitLength(b int) int

BitLength returns the length of the bitfield in bytes.

func BitSetCount

func BitSetCount(b []byte) int

BitSetCount counts the number of 1s in a byte using Hamming weight. See: https://en.wikipedia.org/wiki/Hamming_weight

func CheckBit

func CheckBit(bitfield []byte, index int) (bool, error)

CheckBit checks if a bit in a bit field is one.

func FillBitfield

func FillBitfield(count int) []byte

FillBitfield returns a bitfield of length `count`, all set to true.

func SetBitfield

func SetBitfield(index int) []byte

SetBitfield takes an index and returns bitfield with the index flipped.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL