Skip to content

Main content

Boot Vector Alignment Address Mask Tool

Calculate boot vector alignment address mask from explicit caller-supplied inputs.

Loading tool…

Description

Subtract address modulo alignment for aligned and return the removed offset.

Address calculations distinguish an occupied last byte from an exclusive end, and alignment rounds to a defined boundary. Element counts and byte counts are not interchangeable.

Subtract address modulo alignment for aligned and return the removed offset.

When to use this tool

Use Boot Vector Alignment Address Mask when you need an explicit address, alignment, page, or transfer-count mapping.

How to use the tool and how it works

  1. Enter address, alignment. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read aligned, offset. Use the output convention below.

Require a power-of-two alignment and a 32-bit unsigned address. Subtract address modulo alignment for aligned and return the removed offset.1

Input fieldMeaning and unitsAccepted input
addressAddressRequired. Safe integer; minimum 0; maximum 4294967295.
alignmentAlignmentRequired. Safe integer; minimum 1; maximum 2147483648.
Output fieldInterpretationReturned shape
alignedAlignedRequired. Safe integer.
offsetOffsetRequired. Safe integer.
json
{
  "input": {
    "address": 4660,
    "alignment": 256
  },
  "output": {
    "aligned": 4608,
    "offset": 52
  }
}

Limitations and assumptions

  • This rounds down; it does not validate a boot vector table or choose a device's required alignment.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Validate the resulting span against actual memory bounds and device-specific access and transfer rules.

References

  1. Calculation and input contract: microcontroller/boot-vector-alignment-address-mask — tool.io

Similar or alternative tools