num

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BasePrefixMap = map[int]string{
	2:  "0b",
	8:  "0o",
	16: "0x",
}

Functions

func ClampInt

func ClampInt(min, max, v int) int

func ClampInt64

func ClampInt64(min, max, v int64) int64

func DigitsInBase

func DigitsInBase(n int64, basePrefix bool, base int) int

func MaxInt

func MaxInt(a, b int) int

func MaxInt64

func MaxInt64(a, b int64) int64

func MaxUInt64

func MaxUInt64(a, b uint64) uint64

func MinInt

func MinInt(a, b int) int

func MinInt64

func MinInt64(a, b int64) int64

func MinUInt64

func MinUInt64(a, b uint64) uint64

func PadFormatInt

func PadFormatInt(i int64, base int, basePrefix bool, width int) string

func PadFormatUint

func PadFormatUint(i uint64, base int, basePrefix bool, width int) string

func TwosComplement

func TwosComplement(nBits int, n uint64) int64

func ZigZag

func ZigZag(n uint64) int64

decode zigzag encoded integer https://developers.google.com/protocol-buffers/docs/encoding

Types

type BitRange

type BitRange ranges.Range

func (BitRange) StringByteBits

func (r BitRange) StringByteBits(base int) string

type Bits

type Bits uint64

func (Bits) StringByteBits

func (b Bits) StringByteBits(base int) string

Jump to

Keyboard shortcuts

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