align

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: BSD-3-Clause Imports: 2 Imported by: 7

Documentation

Overview

Package align provides helpers for doing uint alignment.

alignment is done via bit operation at the moment, so alignment size need be a power of 2.

Package align provides helpers for doing uint alignment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Down

func Down[T constraints.Unsigned](v T, alignSize T) T

Down aligns v down to a previous multiple of alignSize.

alignSize need be a power of 2.

func DownPage

func DownPage[T constraints.Unsigned](v T) T

DownPage aligns v down by system page size.

func IsAligned added in v0.13.0

func IsAligned[T constraints.Unsigned](v T, alignSize T) bool

IsAligned checks whether v is aligned to alignSize.

alignSize need be a power of 2.

func Up

func Up[T constraints.Unsigned](v T, alignSize T) T

Up aligns v up to next multiple of alignSize.

alignSize need be a power of 2.

func UpPage

func UpPage[T constraints.Unsigned](v T) T

UpPage aligns v up by system page size.

Types

This section is empty.

Jump to

Keyboard shortcuts

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