memory

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(mem Memory, fieldName string, offset, byteCount uint32) []byte

Read is like api.Memory except that it panics if the offset and byteCount are out of range.

func ReadString

func ReadString(mem Memory, fieldName string, offset, byteCount uint32) string

ReadString is a convenience function that casts requireRead

func TryRead added in v1.3.0

func TryRead(mem Memory, fieldName string, offset, byteCount uint32) ([]byte, error)

TryRead is like api.Memory except that it returns an error when the read is out of range.

func TryReadString added in v1.3.0

func TryReadString(mem Memory, fieldName string, offset, byteCount uint32) (string, error)

TryReadString is a non-panicking variant of ReadString.

func TryWrite added in v1.3.0

func TryWrite(mem Memory, fieldName string, offset uint32, data []byte) error

TryWrite is like api.Memory except that it returns an error when the write is out of range.

func Uint16FromUint32 added in v1.3.0

func Uint16FromUint32(v uint32) (uint16, error)

Uint16FromUint32 safely converts a uint32 to uint16, checking for overflow.

func Uint32FromInt

func Uint32FromInt(v int) (uint32, error)

Uint32FromInt safely converts an int to uint32, checking for negative values and overflow

func Uint32FromUint64 added in v1.3.0

func Uint32FromUint64(v uint64) (uint32, error)

Uint32FromUint64 safely converts a uint64 to uint32, checking for overflow.

func Write

func Write(mem Memory, fieldName string, offset uint32, data []byte)

Write is like api.Memory except that it panics if the offset and byteCount are out of range.

Types

type Memory added in v1.2.7

type Memory interface {
	Read(offset, byteCount uint32) ([]byte, bool)
	Write(offset uint32, data []byte) bool
}

Jump to

Keyboard shortcuts

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