Documentation
¶
Overview ¶
Package pack provides helpers to pack bytes and strings into []uint64 slices.
Index ¶
- func Bytes(data []byte) []uint64
- func BytesInto(data []byte, out []uint64)
- func BytesInv(data []uint64, originalLength int) []byte
- func BytesInvInto(data []uint64, out []byte)
- func BytesPackedLength(data []byte) int
- func ReallocateFlat[T any](d [][]T)
- func String(data string) []uint64
- func StringInto(data string, out []uint64)
- func StringInv(data []uint64, originalLengthBytes int) string
- func StringPackedLength(data string) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes packs a byte slice into a uint64 slice. If the length of the byte slice is not a multiple of 8, it will pad the remaining bytes with zeroes.
func BytesInto ¶ added in v0.4.9
BytesInto packs a byte slice into the given pre-allocated uint64 slice. The output slice should have length >=[BytesPackedLength](data).
func BytesInvInto ¶ added in v0.5.0
BytesInvInto unpacks a []uint64 slice as packed by Bytes into the given byte slice.
func BytesPackedLength ¶ added in v0.4.9
BytesPackedLength return the packed length of the given byte slice.
func ReallocateFlat ¶ added in v0.4.9
func ReallocateFlat[T any](d [][]T)
ReallocateFlat re-allocates the given 2d slice with a flat backing slice.
func String ¶
String packs a string into a uint64 slice. If the length of the string in bytes is not a multiple of 8, it will pad the remaining bytes with zeroes.
func StringInto ¶ added in v0.4.9
String packs a string into the given pre-allocated uint64 slice. The output slice should have length >=[StringPackedLength](data).
func StringPackedLength ¶ added in v0.4.9
StringPackedLength return the packed length of the given byte slice.
Types ¶
This section is empty.