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.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.