align_up | Modular

Mojo function

align_up(value: Int, alignment: Int) -> Int

Returns the closest multiple of alignment that is greater than or equal to value.

Args:

  • value (Int): The value to align.
  • alignment (Int): Value to align to.

Returns:

Int: Closest multiple of the alignment that is greater than or equal to the input value. In other words, ceiling(value / alignment) * alignment.

align_up(value: Scalar[DType.uint], alignment: Scalar[DType.uint]) -> UInt

Returns the closest multiple of alignment that is greater than or equal to value.

Args:

  • value (Scalar): The value to align.
  • alignment (Scalar): Value to align to.

Returns:

UInt: Closest multiple of the alignment that is greater than or equal to the input value. In other words, ceiling(value / alignment) * alignment.