lib

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int8ToByte

func Int8ToByte(num int8) []byte

Int8ToByte converts an int8 to a 1‑byte slice using big‑endian encoding. For negative values, the two's complement representation is used.

func Int16ToByte

func Int16ToByte(num int16) []byte

Int16ToByte converts an int16 to a 2‑byte big‑endian slice.

func Int32ToByte

func Int32ToByte(num int32) []byte

Int32ToByte converts an int32 to a 4‑byte big‑endian slice.

func Int64ToByte

func Int64ToByte(num int64) []byte

Int64ToByte converts an int64 to an 8‑byte big‑endian slice.

func StringToByte

func StringToByte(str string) []byte

StringToByte returns the raw bytes of the given string.

func StringToByteASCII

func StringToByteASCII(str string) []byte

StringToByteASCII returns a byte slice of the same length as the input string, where non‑ASCII runes (code points > 127) are replaced by 0. Note: the length is measured in bytes, not runes, to match Go's string encoding.

func Uint8ToByte

func Uint8ToByte(num uint8) []byte

Uint8ToByte converts a uint8 to a 1‑byte slice.

func Uint16ToByte

func Uint16ToByte(num uint16) []byte

Uint16ToByte converts a uint16 to a 2‑byte big‑endian slice.

func Uint32ToByte

func Uint32ToByte(num uint32) []byte

Uint32ToByte converts a uint32 to a 4‑byte big‑endian slice.

func Uint64ToByte

func Uint64ToByte(num uint64) []byte

Uint64ToByte converts a uint64 to an 8‑byte big‑endian slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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