cbbytes

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Byte = 1 << (iota * 10)
	KB
	MB
	GB
	TB
	PB
	EB
)

IEC Sizes.

View Source
const (
	IByte = 1
	IKB   = IByte * 1000
	IMB   = IKB * 1000
	IGB   = IMB * 1000
	ITB   = IGB * 1000
	IPB   = ITB * 1000
	IEB   = IPB * 1000
)

SI Sizes.

Variables

This section is empty.

Functions

func ArrayByteFloat

func ArrayByteFloat(bs []byte) (result []float32)

func BitLen

func BitLen(x int64) (n int64)

BitLen calculated bit length

func BoolToByte

func BoolToByte(b bool) []byte

func ByteArray2UInt64

func ByteArray2UInt64(bs []byte) uint64

func ByteToFloat32

func ByteToFloat32(bytes []byte) float32

func ByteToFloat32Array

func ByteToFloat32Array(bytes []byte) ([]float32, error)

func ByteToFloat64

func ByteToFloat64(bs []byte) float64

func ByteToString

func ByteToString(b []byte) string

ByteToString convert bytes to string Note: string and slice share a block of memory, for scenarios where slice does not change

func ByteToUInt32

func ByteToUInt32(bs []byte) uint32

func ByteToVector

func ByteToVector(bs []byte) ([]float32, string, error)

func Bytes2Int

func Bytes2Int(bs []byte) int64

func CloneBytes

func CloneBytes(b []byte) []byte

func Float64ToByte

func Float64ToByte(v float64) []byte

func FloatArray

func FloatArray(fa []float32) (code string, err error)

func FloatArrayByte

func FloatArrayByte(fa []float32) (code []byte, err error)

func FormatByte

func FormatByte(s uint64) string

FormatByte convert uint64 to human-readable byte strings

func FormatIByte

func FormatIByte(s uint64) string

FormatIByte convert uint64 to human-readable byte strings

func Int64ToByte

func Int64ToByte(v int64) []byte

func StringToByte

func StringToByte(s string) []byte

StringToByte convert string to bytes Note: string and slice share a block of memory, for scenarios where slice does not change

func UInt32ToByte

func UInt32ToByte(v uint32) []byte

func UnsafeFloat32SliceAsByteSlice

func UnsafeFloat32SliceAsByteSlice(floats []float32) []byte

Returns a slice of the bytes of the provided float64 slice. This allows highly performant access to large float64 slices for such things as computing hashes or simply writing the bytes to a file. BEWARE: this also means this []byte _is platform dependent_.

func ValueToByte

func ValueToByte(fa interface{}) ([]byte, error)

func VectorToByte

func VectorToByte(vector []float32, source string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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