Documentation ¶
Index ¶
- Constants
- Variables
- func Count(v uint64) (int, error)
- func CountBytesBetween(b []byte, min, max uint64) (int, error)
- func CountValues(b []byte) (int, error)
- func CountValuesBigEndian(b []byte) (int, error)
- func Decode(dst *[240]uint64, v uint64) (n int, err error)
- func DecodeAll(dst, src []uint64) (value int, err error)
- func DecodeAllUint16(dst []uint16, src []byte) (value int, err error)
- func DecodeAllUint32(dst []uint32, src []byte) (value int, err error)
- func DecodeAllUint64(dst []uint64, src []byte) (value int, err error)
- func DecodeAllUint8(dst []uint8, src []byte) (value int, err error)
- func DecodeBytesBigEndian(dst []uint64, src []byte) (value int, err error)
- func Encode(src []uint64) (value uint64, n int, err error)
- func EncodeAll(src []uint64) ([]uint64, error)
- func ForEach(b []byte, fn func(v uint64) bool) error
- type Decoder
- type Encoder
Constants ¶
const MaxValue = (1 << 60) - 1
const (
S8B_BIT_SIZE = 60
)
Variables ¶
var BufOvUint16 = [16]int{0, 0, 4, 2, 0, 1, 4, 6, 0, 1, 2, 0, 0, 1, 0, 0}
var BufOvUint32 = [16]int{0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 2, 3, 0, 1, 0, 0}
var BufOvUint8 = [16]int{0, 0, 0, 2, 0, 1, 4, 6, 0, 1, 0, 0, 0, 0, 0, 0}
var (
ErrValueOutOfBounds = errors.New("value out of bounds")
)
Functions ¶
func CountValues ¶
Count returns the number of integers encoded in the byte slice
func CountValuesBigEndian ¶
Count returns the number of integers encoded in the byte slice
func DecodeAll ¶
Decode writes the uncompressed values from src to dst. It returns the number of values written or an error. nocheckptr while the underlying struct layout doesn't change
func DecodeAllUint16 ¶
Decode writes the uncompressed values from src to dst. It returns the number of values written or an error.
func DecodeAllUint32 ¶
Decode writes the uncompressed values from src to dst. It returns the number of values written or an error.
func DecodeAllUint64 ¶
Decode writes the uncompressed values from src to dst. It returns the number of values written or an error.
func DecodeAllUint8 ¶
Decode writes the uncompressed values from src to dst. It returns the number of values written or an error.
func DecodeBytesBigEndian ¶
DecodeBytesBigEndian writes the compressed, big-endian values from src to dst. It returns the number of values written or an error.
func Encode ¶
Encode packs as many values into a single uint64. It returns the packed uint64, how many values from src were packed, or an error if the values exceed the maximum value range.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder converts a compressed byte slice to a stream of unsigned 64bit integers.
func (*Decoder) Next ¶
Next returns true if there are remaining values to be read. Successive calls to Next advance the current element pointer.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder converts a stream of unsigned 64bit integers to a compressed byte slice.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder returns an Encoder able to convert uint64s to compressed byte slices