num

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignDown

func AlignDown[T Uint](n, a T) T

AlignDown rounds n down to multiple of a. a must be a power of 2.

func AlignUp

func AlignUp[T Uint](n, a T) T

AlignUp rounds n up to multiple of a. a must be a power of 2.

func IsPowerOfTwo

func IsPowerOfTwo[T Integer](x T) bool

Types

type Complex

type Complex interface {
	~complex64 | ~complex128
}

Complex is the type union of all complex types.

type Float

type Float interface {
	~float32 | ~float64
}

Float is the type union of floating-point types.

type Int

type Int interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

Int is the type union of signed integers.

type Integer

type Integer interface {
	Int | Uint
}

Integer is the type union of both signed and unsigned integers.

type Number

type Number interface {
	Real | Complex
}

Number is the type union of all numeric types.

type Pointer

type Pointer interface {
	~uintptr | ~unsafe.Pointer
}

Pointer represents all numeric types that can be a pointer value

type Real

type Real interface {
	Integer | Float
}

Real is the type union of all real number types.

type Uint

type Uint interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Uint is the type union of unsigned integers.

Jump to

Keyboard shortcuts

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