entry

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 1 Imported by: 13 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Entry

Collection of compact entries based on bit shift operations.

Currently, supports 3 variants:

  • Entry12 (compacts uint16/uint8 lo/hi values)
  • Entry16 (compacts uint8 lo/hi values)
  • Entry24 (compacts uint32/uint8 lo/hi values)
  • Entry32 (compacts uint16 lo/hi values)
  • Entry48 (compacts uint64/uint16 lo/hi values)
  • Entry64 (compacts uint32 lo/hi values)
Usage
buf := "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
offset, length := uint16(6), uint16(11)
var e entry.Entry32
e.Encode(offset, length)
...
lo, hi := e.Decode()
println(buf[lo:hi]) // ipsum

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry12

type Entry12 uint16

Entry12 compacts uint12 lo and uint4 hi values.

func NewEntry12 added in v1.0.2

func NewEntry12(lo uint16, hi uint8) Entry12

func (*Entry12) Decode

func (e *Entry12) Decode() (lo uint16, hi uint8)

Decode splits e to lo/hi uint8 values.

func (*Entry12) Encode

func (e *Entry12) Encode(lo uint16, hi uint8)

Encode combines uint12 lo and uint4 hi values into one uint16 int.

func (*Entry12) ExtractFrom added in v1.0.3

func (e *Entry12) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry12) ExtractFromString added in v1.0.3

func (e *Entry12) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry12) Hi added in v1.0.2

func (e *Entry12) Hi() uint8

Hi return high part of entry.

func (*Entry12) Lo added in v1.0.2

func (e *Entry12) Lo() uint16

Lo return low part of entry.

func (*Entry12) Reset

func (e *Entry12) Reset()

func (*Entry12) String added in v1.0.3

func (e *Entry12) String() string

type Entry16

type Entry16 uint16

Entry16 compacts uint8 lo/hi values.

func NewEntry16 added in v1.0.2

func NewEntry16(lo, hi uint8) Entry16

func (*Entry16) Decode

func (e *Entry16) Decode() (lo, hi uint8)

Decode splits e to lo/hi uint8 values.

func (*Entry16) Encode

func (e *Entry16) Encode(lo, hi uint8)

Encode combines lo/hi values into one uint16 int.

func (*Entry16) ExtractFrom added in v1.0.3

func (e *Entry16) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry16) ExtractFromString added in v1.0.3

func (e *Entry16) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry16) Hi added in v1.0.2

func (e *Entry16) Hi() uint8

Hi return high part of entry.

func (*Entry16) Lo added in v1.0.2

func (e *Entry16) Lo() uint8

Lo return low part of entry.

func (*Entry16) Reset

func (e *Entry16) Reset()

func (*Entry16) String added in v1.0.3

func (e *Entry16) String() string

type Entry24

type Entry24 uint32

Entry24 compacts uint24 lo and uint8 hi values.

func NewEntry24 added in v1.0.2

func NewEntry24(lo uint32, hi uint8) Entry24

func (*Entry24) Decode

func (e *Entry24) Decode() (lo uint32, hi uint8)

Decode splits e to lo/hi uint16 values.

func (*Entry24) Encode

func (e *Entry24) Encode(lo uint32, hi uint8)

Encode combines uint24 lo and uint8 hi values into one uint64 int.

func (*Entry24) ExtractFrom added in v1.0.3

func (e *Entry24) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry24) ExtractFromString added in v1.0.3

func (e *Entry24) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry24) Hi added in v1.0.2

func (e *Entry24) Hi() uint8

Hi return high part of entry.

func (*Entry24) Lo added in v1.0.2

func (e *Entry24) Lo() uint32

Lo return low part of entry.

func (*Entry24) Reset

func (e *Entry24) Reset()

func (*Entry24) String added in v1.0.3

func (e *Entry24) String() string

type Entry32

type Entry32 uint32

Entry32 compacts uint16 lo/hi values.

func NewEntry32 added in v1.0.2

func NewEntry32(lo, hi uint16) Entry32

func (*Entry32) Decode

func (e *Entry32) Decode() (lo, hi uint16)

Decode splits e to lo/hi uint16 values.

func (*Entry32) Encode

func (e *Entry32) Encode(lo, hi uint16)

Encode combines lo/hi values into one uint32 int.

func (*Entry32) ExtractFrom added in v1.0.3

func (e *Entry32) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry32) ExtractFromString added in v1.0.3

func (e *Entry32) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry32) Hi added in v1.0.2

func (e *Entry32) Hi() uint16

Hi return high part of entry.

func (*Entry32) Lo added in v1.0.2

func (e *Entry32) Lo() uint16

Lo return low part of entry.

func (*Entry32) Reset

func (e *Entry32) Reset()

func (*Entry32) String added in v1.0.3

func (e *Entry32) String() string

type Entry48

type Entry48 uint64

Entry48 compacts uint64 lo and uint16 hi values.

func NewEntry48 added in v1.0.2

func NewEntry48(lo uint64, hi uint16) Entry48

func (*Entry48) Decode

func (e *Entry48) Decode() (lo uint64, hi uint16)

Decode splits e to uint48 lo and uint16 hi values.

func (*Entry48) Encode

func (e *Entry48) Encode(lo uint64, hi uint16)

Encode combines uint48 lo and uint16 hi values into one uint64 int.

func (*Entry48) ExtractFrom added in v1.0.3

func (e *Entry48) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry48) ExtractFromString added in v1.0.3

func (e *Entry48) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry48) Hi added in v1.0.2

func (e *Entry48) Hi() uint16

Hi return high part of entry.

func (*Entry48) Lo added in v1.0.2

func (e *Entry48) Lo() uint64

Lo return low part of entry.

func (*Entry48) Reset

func (e *Entry48) Reset()

func (*Entry48) String added in v1.0.3

func (e *Entry48) String() string

type Entry64

type Entry64 uint64

Entry64 compacts uint32 lo/hi values.

func NewEntry64 added in v1.0.2

func NewEntry64(lo, hi uint32) Entry64

func (*Entry64) Decode

func (e *Entry64) Decode() (lo, hi uint32)

Decode splits e to lo/hi uint32 values.

func (*Entry64) Encode

func (e *Entry64) Encode(lo, hi uint32) Entry64

Encode combines lo/hi values into one uint64 int.

func (*Entry64) ExtractFrom added in v1.0.3

func (e *Entry64) ExtractFrom(b []byte) []byte

ExtractFrom takes [lo:hi] subslice from b.

func (*Entry64) ExtractFromString added in v1.0.3

func (e *Entry64) ExtractFromString(s string) string

ExtractFromString takes [lo:hi] substring from s.

func (*Entry64) Hi added in v1.0.2

func (e *Entry64) Hi() uint32

Hi return high part of entry.

func (*Entry64) Lo added in v1.0.2

func (e *Entry64) Lo() uint32

Lo return low part of entry.

func (*Entry64) Reset

func (e *Entry64) Reset()

func (*Entry64) String added in v1.0.3

func (e *Entry64) String() string

Jump to

Keyboard shortcuts

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