nazabits

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 0 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBit16 added in v0.10.0

func GetBit16(v []byte, pos uint) uint8

func GetBit8

func GetBit8(v uint8, pos uint) uint8

@param pos: 取值范围 [0, 7],0表示最低位

func GetBits16 added in v0.10.0

func GetBits16(v []byte, pos uint, n uint) uint16

func GetBits8

func GetBits8(v uint8, pos uint, n uint) uint8

@param pos: 取值范围 [0, 7],0表示最低位 @param n: 取多少位, 取值范围 [1, 8]

举例,GetBits8(105, 2, 4) = 10(即1010)

v: 0110 1001

pos: 2

n:   .. ..

Types

type BitReader added in v0.11.0

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

func NewBitReader added in v0.11.0

func NewBitReader(b []byte) BitReader

func (*BitReader) ReadBit added in v0.11.0

func (br *BitReader) ReadBit() uint8

func (*BitReader) ReadBits added in v0.11.0

func (br *BitReader) ReadBits(n uint) (r uint8)

目前限制一次最多读8位,大于8位可以分多次读,或者以后把限制放开

type BitWriter added in v0.11.0

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

func NewBitWriter added in v0.11.0

func NewBitWriter(b []byte) BitWriter

func (*BitWriter) WriteBit added in v0.11.0

func (bw *BitWriter) WriteBit(b uint8)

func (*BitWriter) WriteBits added in v0.11.0

func (bw *BitWriter) WriteBits(n int, v uint8)

目前限制一次最多写8位,大于8位可以分多次写,或者以后把限制放开

Jump to

Keyboard shortcuts

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