"std:encoding/binary"Provides functions for encoding and decoding integer values to and from byte slices in big-endian and little-endian byte order. All functions use pure bit manipulation with no external dependencies.
View source on Codeberg →func BigEndianUint16(b []byte) uint16
Decodes a uint16 from the first 2 bytes of b using big-endian byte order.
func BigEndianUint32(b []byte) uint32
Decodes a uint32 from the first 4 bytes of b using big-endian byte order.
func BigEndianUint64(b []byte) uint64
Decodes a uint64 from the first 8 bytes of b using big-endian byte order.
func BigEndianPutUint16(b []byte, v uint16)
Encodes a uint16 into the first 2 bytes of b using big-endian byte order.
func BigEndianPutUint32(b []byte, v uint32)
Encodes a uint32 into the first 4 bytes of b using big-endian byte order.
func BigEndianPutUint64(b []byte, v uint64)
Encodes a uint64 into the first 8 bytes of b using big-endian byte order.
func LittleEndianUint16(b []byte) uint16
Decodes a uint16 from the first 2 bytes of b using little-endian byte order.
func LittleEndianUint32(b []byte) uint32
Decodes a uint32 from the first 4 bytes of b using little-endian byte order.
func LittleEndianUint64(b []byte) uint64
Decodes a uint64 from the first 8 bytes of b using little-endian byte order.
func LittleEndianPutUint16(b []byte, v uint16)
Encodes a uint16 into the first 2 bytes of b using little-endian byte order.
func LittleEndianPutUint32(b []byte, v uint32)
Encodes a uint32 into the first 4 bytes of b using little-endian byte order.
func LittleEndianPutUint64(b []byte, v uint64)
Encodes a uint64 into the first 8 bytes of b using little-endian byte order.