Documentation
¶
Index ¶
- func Int8ToByte(num int8) []byte
- func Int16ToByte(num int16) []byte
- func Int32ToByte(num int32) []byte
- func Int64ToByte(num int64) []byte
- func StringToByte(str string) []byte
- func StringToByteASCII(str string) []byte
- func Uint8ToByte(num uint8) []byte
- func Uint16ToByte(num uint16) []byte
- func Uint32ToByte(num uint32) []byte
- func Uint64ToByte(num uint64) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Int8ToByte ¶
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 ¶
Int16ToByte converts an int16 to a 2‑byte big‑endian slice.
func Int32ToByte ¶
Int32ToByte converts an int32 to a 4‑byte big‑endian slice.
func Int64ToByte ¶
Int64ToByte converts an int64 to an 8‑byte big‑endian slice.
func StringToByte ¶
StringToByte returns the raw bytes of the given string.
func StringToByteASCII ¶
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 ¶
Uint8ToByte converts a uint8 to a 1‑byte slice.
func Uint16ToByte ¶
Uint16ToByte converts a uint16 to a 2‑byte big‑endian slice.
func Uint32ToByte ¶
Uint32ToByte converts a uint32 to a 4‑byte big‑endian slice.
func Uint64ToByte ¶
Uint64ToByte converts a uint64 to an 8‑byte big‑endian slice.
Types ¶
This section is empty.