entry

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 0 Imported by: 13

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) 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()

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) 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()

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) 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()

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) 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()

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) 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()

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) 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()

Jump to

Keyboard shortcuts

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