siaencoding

package
v0.0.0-...-058445b Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2014 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecFloat32

func DecFloat32(b []byte) (f float32)

DecFloat32 decodes a slice of 4 bytes into a float32. It panics if len(b) < 4.

func DecFloat64

func DecFloat64(b []byte) (f float64)

DecFloat64 decodes a slice of 8 bytes into a float64. It panics if len(b) < 8.

func DecInt32

func DecInt32(b []byte) int32

DecInt32 decodes a slice of 4 bytes into an int32. It panics if len(b) < 4.

func DecInt64

func DecInt64(b []byte) int64

DecInt64 decodes a slice of 8 bytes into an int64. It panics if len(b) < 8.

func DecUint128

func DecUint128(b []byte) (i *big.Int)

DecUint128 decodes a slice of 16 bytes into a big.Int It panics if len(b) < 16.

func DecUint16

func DecUint16(b []byte) uint16

DecUint16 decodes a slice of 2 bytes into a uint16. It panics if len(b) < 2.

func DecUint32

func DecUint32(b []byte) uint32

DecUint32 decodes a slice of 4 bytes into a uint32. It panics if len(b) < 4.

func DecUint64

func DecUint64(b []byte) uint64

DecUint64 decodes a slice of 8 bytes into a uint64. It panics if len(b) < 8.

func EncFloat32

func EncFloat32(f float32) (b []byte)

EncFloat32 encodes a float32 as a slice of 4 bytes.

func EncFloat64

func EncFloat64(f float64) (b []byte)

EncFloat64 encodes a float64 as a slice of 8 bytes.

func EncInt32

func EncInt32(i int32) (b []byte)

EncInt32 encodes an int32 as a slice of 4 bytes.

func EncInt64

func EncInt64(i int64) (b []byte)

EncInt64 encodes an int64 as a slice of 8 bytes.

func EncUint128

func EncUint128(i *big.Int) (b []byte)

EncUint128 encodes a big.Int as a slice of 16 bytes. big.Ints are stored in big-endian format, so they must be converted to little-endian before being returned.

func EncUint16

func EncUint16(i uint16) (b []byte)

EncUint16 encodes a uint16 as a slice of 2 bytes.

func EncUint32

func EncUint32(i uint32) (b []byte)

EncUint32 encodes a uint32 as a slice of 4 bytes.

func EncUint64

func EncUint64(i uint64) (b []byte)

EncUint64 encodes a uint64 as a slice of 8 bytes.

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal is the generic function used to marshal all public and over-the-wire data used on Sia. By implementation, it's just making a call to json. We use our own function, however, because if the spec is changed to use an encoding other than json (which is likely), then it we will only need to make changes in one place.

func Unmarshal

func Unmarshal(b []byte, v interface{}) error

Unmarshal is the inverse of Marshal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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