Aligned Field Offset Table

Lay out explicit byte field lengths with per-field integer alignment and report every padding gap; no ABI inference.

Description

Lay out explicit byte field lengths with per-field integer alignment and report every padding gap; no ABI inference.

Aligned fields may need padding before each field, based on its absolute offset rather than its own length.

When to use this tool

Lay out explicit byte field lengths with per-field integer alignment and report every padding gap; no ABI inference.

  • Prepare the supplied lengths, alignments, initialOffset fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter lengths, alignments, initialOffset. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.fields, result.endOffset. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require aligned lengths/alignments, nonnegative integer initialOffset and lengths, and positive integer alignments. Add nonnegative modulo(-offset,alignment), record start/end/padding, then advance by length.1

Input fieldMeaning and representationAccepted input
lengthslengths.List of finite numbers; at most 128 entries
alignmentsalignments.List of finite numbers; at most 128 entries
initialOffsetinitial offset.Integer from 0 to 1e9 inclusive
Output fieldInterpretation
resultObject containing the named outputs below.
result.fieldsThe fields list in the ordering and representation described above.
result.endOffsetThe end offset value under the stated formula or text convention.
json
{
  "input": {
    "lengths": [
      1,
      2
    ],
    "alignments": [
      1,
      4
    ],
    "initialOffset": 0
  },
  "output": {
    "result": {
      "fields": [
        {
          "start": 0,
          "end": 1,
          "padding": 0
        },
        {
          "start": 4,
          "end": 6,
          "padding": 3
        }
      ],
      "endOffset": 6
    }
  }
}

Limitations and assumptions

  • Alignments need not be powers of two. No final structure alignment, implicit header or actual memory allocation is added.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Retain the field-width, bit-index and byte-order conventions when combining operations. Slicing, escaping, permutation and alignment are separate transforms; none supplies a complete framing or cryptographic protocol.

References

  1. Tool behavior and example: Aligned Field Offset Table — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies