utils

package
v0.0.0-...-a063660 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayToHexString

func ByteArrayToHexString(array []byte, n int) (hex string)

func BytesToFloat

func BytesToFloat(arr []byte, reverse bool) float64

func BytesToInt

func BytesToInt(arr []byte, reverse bool) int64

func CalculateDistance

func CalculateDistance(loc1, loc2 *Location) float64

func Contains

func Contains(array interface{}, item interface{}) (bool, int)

func CreateBytes

func CreateBytes(value byte, length, size int) []byte

func CreateInts

func CreateInts(value, length, size int) []int

func FloatToBytes

func FloatToBytes(dec float64, bytes byte, reverse bool) []byte

func IntToBytes

func IntToBytes(dec uint64, bytes byte, reverse bool) []byte

func IntsToBytes

func IntsToBytes(ints ...int) []byte

func Keys

func Keys(a map[int]interface{}) []int

func MapDiff

func MapDiff(a, b map[interface{}]interface{}) map[interface{}]interface{}

func ParseFloat

func ParseFloat(d string) float64

func PvPFunc

func PvPFunc(val int) int

func RandFloat

func RandFloat(min, max float64) float64

func RandFloats

func RandFloats(min, max float64, count int) []float64

func RandInt

func RandInt(min, max int64) int64

func SearchUInt64

func SearchUInt64(a []uint64, x uint64) int

func SigmaFunc

func SigmaFunc(x float64) float64

func SliceDiff

func SliceDiff(a, b []int) []int

Types

type Location

type Location struct {
	X float64
	Y float64
}

func (*Location) String

func (l *Location) String() string

type Packet

type Packet []byte

func (*Packet) Concat

func (p *Packet) Concat(data []byte)

func (*Packet) Insert

func (p *Packet) Insert(data []byte, i int)

func (*Packet) Overwrite

func (p *Packet) Overwrite(data []byte, i int)

func (*Packet) Print

func (p *Packet) Print()

func (*Packet) SetLength

func (p *Packet) SetLength(length int16)

type SMap

type SMap struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap() *SMap

func (*SMap) Add

func (m *SMap) Add(key, val interface{})

func (*SMap) Clear

func (m *SMap) Clear()

func (*SMap) Delete

func (m *SMap) Delete(key interface{})

func (*SMap) Get

func (m *SMap) Get(key interface{}) interface{}

func (*SMap) Keys

func (m *SMap) Keys() []interface{}

func (*SMap) PopValues

func (m *SMap) PopValues() []interface{}

func (*SMap) Values

func (m *SMap) Values() []interface{}

Jump to

Keyboard shortcuts

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