align

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Down

func Down[T Unsigned](v, a T) T

Down aligns v down to the previous multiple of a.

a must be a power of two.

func Up

func Up[T Unsigned](v, a T) T

Up aligns v up to the next multiple of a.

a must be a power of two.

Types

type Unsigned

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

Unsigned is a local type constraint for unsigned integers.

We intentionally avoid external dependencies (e.g. golang.org/x/exp/constraints) to keep go-foundation stdlib-only.

Jump to

Keyboard shortcuts

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