bits

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInt32

func AddInt32(data []int32, value int32)

func AddInt64

func AddInt64(data []int64, value int64)

func BitCount

func BitCount(count int) uint

func BoolToBytes

func BoolToBytes(data []bool) []byte

func ByteCount

func ByteCount(count uint) int

func BytesToBool

func BytesToBool(data []byte) []bool

func BytesToFloat32

func BytesToFloat32(data []byte) []float32

func BytesToFloat64

func BytesToFloat64(data []byte) []float64

func BytesToInt16

func BytesToInt16(data []byte) []int16

func BytesToInt32

func BytesToInt32(data []byte) []int32

func BytesToInt64

func BytesToInt64(data []byte) []int64

func BytesToInt8

func BytesToInt8(data []byte) []int8

func BytesToString

func BytesToString(data []byte) string

func BytesToUint128

func BytesToUint128(data []byte) [][16]byte

func BytesToUint32

func BytesToUint32(data []byte) []uint32

func BytesToUint64

func BytesToUint64(data []byte) []uint64

func CountByte

func CountByte(data []byte, value byte) int

func Fill

func Fill(dst []byte, dstWidth uint, src uint64, srcWidth uint) int

Fill is an algorithm similar to the stdlib's bytes.Repeat, it writes repeated copies of the source pattern to the destination, returning the number of copies made.

func Float32ToBytes

func Float32ToBytes(data []float32) []byte

func Float32ToUint32

func Float32ToUint32(data []float32) []uint32

func Float64ToBytes

func Float64ToBytes(data []float64) []byte

func Float64ToUint64

func Float64ToUint64(data []float64) []uint64

func IndexShift16

func IndexShift16(bitIndex uint) (index, shift uint)

func IndexShift32

func IndexShift32(bitIndex uint) (index, shift uint)

func IndexShift64

func IndexShift64(bitIndex uint) (index, shift uint)

func IndexShift8

func IndexShift8(bitIndex uint) (index, shift uint)

func Int16ToBytes

func Int16ToBytes(data []int16) []byte

func Int16ToUint16

func Int16ToUint16(data []int16) []uint16

func Int32ToBytes

func Int32ToBytes(data []int32) []byte

func Int32ToUint32

func Int32ToUint32(data []int32) []uint32

func Int64ToBytes

func Int64ToBytes(data []int64) []byte

func Int64ToUint64

func Int64ToUint64(data []int64) []uint64

func Int8ToBytes

func Int8ToBytes(data []int8) []byte

func Len16

func Len16(i int16) int

func Len32

func Len32(i int32) int

func Len64

func Len64(i int64) int

func Len8

func Len8(i int8) int

func MaxBool

func MaxBool(data []bool) (max bool)

func MaxFixedLenByteArray

func MaxFixedLenByteArray(size int, data []byte) (max []byte)

func MaxFloat32

func MaxFloat32(data []float32) (max float32)

func MaxFloat64

func MaxFloat64(data []float64) (max float64)

func MaxInt32

func MaxInt32(data []int32) (max int32)

func MaxInt64

func MaxInt64(data []int64) (max int64)

func MaxLen16

func MaxLen16(data []int16) int

func MaxLen32

func MaxLen32(data []int32) int

func MaxLen64

func MaxLen64(data []int64) int

func MaxLen8

func MaxLen8(data []int8) int

func MaxUint32

func MaxUint32(data []uint32) (max uint32)

func MaxUint64

func MaxUint64(data []uint64) (max uint64)

func MinBool

func MinBool(data []bool) (min bool)

func MinFixedLenByteArray

func MinFixedLenByteArray(size int, data []byte) (min []byte)

func MinFloat32

func MinFloat32(data []float32) (min float32)

func MinFloat64

func MinFloat64(data []float64) (min float64)

func MinInt32

func MinInt32(data []int32) (min int32)

func MinInt64

func MinInt64(data []int64) (min int64)

func MinMaxBool

func MinMaxBool(data []bool) (min, max bool)

func MinMaxFixedLenByteArray

func MinMaxFixedLenByteArray(size int, data []byte) (min, max []byte)

func MinMaxFloat32

func MinMaxFloat32(data []float32) (min, max float32)

func MinMaxFloat64

func MinMaxFloat64(data []float64) (min, max float64)

func MinMaxInt32

func MinMaxInt32(data []int32) (min, max int32)

func MinMaxInt64

func MinMaxInt64(data []int64) (min, max int64)

func MinMaxUint32

func MinMaxUint32(data []uint32) (min, max uint32)

func MinMaxUint64

func MinMaxUint64(data []uint64) (min, max uint64)

func MinUint32

func MinUint32(data []uint32) (min uint32)

func MinUint64

func MinUint64(data []uint64) (min uint64)

func NearestPowerOfTwo

func NearestPowerOfTwo(v int) int

func NearestPowerOfTwo32

func NearestPowerOfTwo32(v uint32) uint32

func NearestPowerOfTwo64

func NearestPowerOfTwo64(v uint64) uint64

func OrderOfBool

func OrderOfBool(data []bool) int

func OrderOfBytes

func OrderOfBytes(data [][]byte) int

func OrderOfFloat32

func OrderOfFloat32(data []float32) int

func OrderOfFloat64

func OrderOfFloat64(data []float64) int

func OrderOfInt32

func OrderOfInt32(data []int32) int

func OrderOfInt64

func OrderOfInt64(data []int64) int

func OrderOfUint32

func OrderOfUint32(data []uint32) int

func OrderOfUint64

func OrderOfUint64(data []uint64) int

func Pack

func Pack(dst []byte, dstWidth uint, src []byte, srcWidth uint) int

Pack copies words of size srcWidth (in bits) from the src buffer to words of size dstWidth (in bits) in the dst buffer, returning the number of words that were packed.

When dstWidth is greater than srcWidth, the upper bits of the destination word are set to zero.

When srcWidth is greater than dstWith, the upper bits of the source are discarded.

The function always writes full bytes to dst, if the last word written does not end on a byte boundary, the remaining bits are set to zero.

The source and destination buffers must not overlap.

func Round

func Round(count uint) uint

func ShiftRight

func ShiftRight(data []byte, shift uint)

func SubInt32

func SubInt32(data []int32, value int32)

func SubInt64

func SubInt64(data []int64, value int64)

func Uint128ToBytes

func Uint128ToBytes(data [][16]byte) []byte

func Uint32ToBytes

func Uint32ToBytes(data []uint32) []byte

func Uint32ToInt32

func Uint32ToInt32(data []uint32) []int32

func Uint64ToBytes

func Uint64ToBytes(data []uint64) []byte

func Uint64ToInt64

func Uint64ToInt64(data []uint64) []int64

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func (*Reader) ReadBit

func (r *Reader) ReadBit() (int, error)

func (*Reader) ReadBits

func (r *Reader) ReadBits(count uint) (uint64, uint, error)

func (*Reader) Reset

func (r *Reader) Reset(rr io.Reader)

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func (*Writer) Buffered

func (w *Writer) Buffered() int

func (*Writer) Flush

func (w *Writer) Flush() error

func (*Writer) Reset

func (w *Writer) Reset(ww io.Writer)

func (*Writer) WriteBit

func (w *Writer) WriteBit(bit int)

func (*Writer) WriteBits

func (w *Writer) WriteBits(bits uint64, count uint)

Jump to

Keyboard shortcuts

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