Module osm.util.checked

Checked integer arithmetic for codecs and exact coordinate decoding.

All helpers reject unrepresentable results before executing an overflowing operation. On failure they return false; callers must treat the output parameter as unspecified unless the function returned true.

These helpers are intended for untrusted encoded input and therefore form part of the data-integrity boundary.

Date

2026-09-12

Functions

NameDescription
checkedAdd(a, b, result) Add two signed 64-bit values without overflow.
checkedMul(a, b, result) Multiply two signed 64-bit values without overflow.
checkedMulAdd(base, factor, value, result) Compute base + factor * value without overflow.
checkedSub(a, b, result) Subtract two signed 64-bit values without overflow.