binary

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT, Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BTo

func BTo[T constraints.Integer](b []byte) T

func BinaryTo

func BinaryTo[T constraints.Integer](b []byte) T

func BytesToMyStruct

func BytesToMyStruct(b []byte) unsafe.Pointer

func Int64To

func Int64To(i int64) []byte

func IntTo

func IntTo(i int) []byte

func StructToBytes

func StructToBytes(s interface{}) []byte

func ToB

func ToB[T constraints.Integer](v T) []byte

func ToBinary

func ToBinary[T constraints.Integer](v T) []byte

func ToInt

func ToInt(b []byte) int

func ToInt64

func ToInt64(b []byte) int64

func ToUint

func ToUint(b []byte) uint64

比标准库慢很多,10倍左右,string和bytes互转只是节省复制内存,unsafe操作有很多检测 binary.LittleEndian.Uint64(b)

func UintTo

func UintTo(i uint64) []byte

binary.LittleEndian.PutUint64(b)

Types

This section is empty.

Jump to

Keyboard shortcuts

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