util

package
v0.0.0-...-8faa606 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitIsSet

func BitIsSet(number, bitPosition uint8) bool

Tells whether the number has the nth bit set.

bitPosition must be in the range 0-7.

func BitSet

func BitSet(number, bitPosition uint8, doSet bool) uint8

Returns a new number with the nth bit set or clear.

bitPosition must be in the range 0-7.

func BoolToInt32

func BoolToInt32(b bool) int32

Syntactic sugar; converts bool to 0 or 1.

func BoolToUint8

func BoolToUint8(b bool) uint8

Syntactic sugar; converts bool to 0 or 1.

func BoolToUintptr

func BoolToUintptr(b bool) uintptr

Syntactic sugar; converts bool to 0 or 1.

func Break16

func Break16(val uint16) (lo, hi uint8)

Breaks an uint16 into low and high uint8.

func Break32

func Break32(val uint32) (lo, hi uint16)

Breaks an uint32 into low and high uint16.

func Break64

func Break64(val uint64) (lo, hi uint32)

Breaks an uint64 into low and high uint32.

func DurationToNano100

func DurationToNano100(duration time.Duration) int64

Converts time.Duration to 100 nanoseconds.

func Iif

func Iif(cond bool, ifTrue, ifFalse interface{}) interface{}

Returns first value if condition is true, otherwise returns second.

Return type must be cast accordingly.

func Make16

func Make16(lo, hi uint8) uint16

Assembles an uint16 from two uint8.

func Make32

func Make32(lo, hi uint16) uint32

Assembles an uint32 from two uint16.

func Make64

func Make64(lo, hi uint32) uint64

Assembles an uint64 from two uint32.

func Nano100ToDuration

func Nano100ToDuration(nanosec100 int64) time.Duration

Converts 100 nanoseconds to time.Duration.

func RemoveAccelAmpersands

func RemoveAccelAmpersands(text string) string

"&He && she" becomes "He & she".

func ReverseBytes64

func ReverseBytes64(n uint64) uint64

Reverses the bytes, not the bits.

Types

This section is empty.

Jump to

Keyboard shortcuts

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