Description
Return floor(length / 2) as halfIndex and mark odd lengths.
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.
Return floor(length / 2) as halfIndex and mark odd lengths.
When to use this tool
Use DMA Circular Buffer Half Transfer Index when you need an explicit address, alignment, page, or transfer-count mapping.
How to use the tool and how it works
- Enter length, requireEven. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read halfIndex, odd. Inspect odd before interpreting the associated values.
Return floor(length / 2) as halfIndex and mark odd lengths. Reject odd input only when requireEven is true.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| length | Length | Required. Safe integer; minimum 2. |
| requireEven | Require Even | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| halfIndex | Half Index | Required. Safe integer. |
| odd | Odd | Required. Boolean. |
{
"input": {
"length": 8,
"requireEven": true
},
"output": {
"halfIndex": 4,
"odd": false
}
} Limitations and assumptions
- The index is a supplied buffer split convention, not proof that hardware issues a half-transfer event there.
- 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
Similar or alternative tools
- Microcontroller: DMA Circular Buffer End Address
Multiply elementCount by elementBytes using exact integers and add baseAddress.
- Timer Prescaler Counter Bit Budget
Floor inputTicks / prescaler for counterTicks.