segment

package
Version: v0.0.0-...-5b112dc Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Int8Size       = 1
	Int16Size      = 2
	Int32Size      = 4
	Int64Size      = 8
	Uint8Size      = 1
	Uint16Size     = 2
	Uint32Size     = 4
	Uint64Size     = 8
	Float32Size    = 4
	Float64Size    = 8
	Complex64Size  = 8
	Complex128Size = 16
)

Sizes of types in bytes.

View Source
const MaxUintptr = ^uintptr(0)

MaxUintptr is the maximum platform dependent unsigned integer large enough to store the uninterpreted bits of a pointer value.

Variables

View Source
var ErrBadValue = fmt.Errorf("segment: bad value")
View Source
var ErrOutOfBounds = fmt.Errorf("segment: out of bounds")
View Source
var Fault = fmt.Errorf("segmentation fault")

Functions

This section is empty.

Types

type Segment

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

Segment is a data segment. See https://golang.org/ref/spec#Numeric_types for details.

func New

func New(offset int64, data []byte) *Segment

New returns a new data segment.

func (*Segment) Complex128

func (seg *Segment) Complex128(offset int64) *complex128

Complex128 returns a pointer to the complex number with float64 real and imaginary parts from this segment or panics at the access violation.

func (*Segment) Complex64

func (seg *Segment) Complex64(offset int64) *complex64

Complex64 returns a pointer to the complex number with float32 real and imaginary parts from this segment or panics at the access violation.

func (*Segment) Float32

func (seg *Segment) Float32(offset int64) *float32

Float32 returns a pointer to the IEEE-754 32-bit floating-point number from this segment or panics at the access violation.

func (*Segment) Float64

func (seg *Segment) Float64(offset int64) *float64

Float64 returns a pointer to the IEEE-754 64-bit floating-point number from this segment or panics at the access violation.

func (*Segment) Int16

func (seg *Segment) Int16(offset int64) *int16

Int16 returns a pointer to the signed 16-bit integer from this segment or panics at the access violation.

func (*Segment) Int32

func (seg *Segment) Int32(offset int64) *int32

Int32 returns a pointer to the signed 32-bit integer from this segment or panics at the access violation.

func (*Segment) Int64

func (seg *Segment) Int64(offset int64) *int64

Int64 returns a pointer to the signed 64-bit integer from this segment or panics at the access violation.

func (*Segment) Int8

func (seg *Segment) Int8(offset int64) *int8

Int8 returns a pointer to the signed 8-bit integer from this segment or panics at the access violation.

func (*Segment) Pointer

func (seg *Segment) Pointer(offset int64, length uintptr) uintptr

Pointer returns an untyped pointer to the value from this segment or panics at the access violation.

func (*Segment) ScanUint

func (seg *Segment) ScanUint(offset int64, v ...interface{}) error

ScanUint sequentially reads the data into the unsigned integers pointed by v starting from the given offset.

func (*Segment) Uint16

func (seg *Segment) Uint16(offset int64) *uint16

Uint16 returns a pointer to the unsigned 16-bit integer from this segment or panics at the access violation.

func (*Segment) Uint32

func (seg *Segment) Uint32(offset int64) *uint32

Uint32 returns a pointer to the unsigned 32-bit integer from this segment or panics at the access violation.

func (*Segment) Uint64

func (seg *Segment) Uint64(offset int64) *uint64

Uint16 returns a pointer to the unsigned 64-bit integer from this segment or panics at the access violation.

func (*Segment) Uint8

func (seg *Segment) Uint8(offset int64) *uint8

Uint8 returns a pointer to the unsigned 8-bit integer from this segment or panics at the access violation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL