Esote esote.net

bsa

branch-free saturating arithmetic library

A library for branch-free saturating arithmetic of unsigned and signed 8, 16, 32, and 64 addition, subtraction, division, and multiplication. "Saturate" meaning the values cannot underflow or overflow, but instead are limited by their _MIN and _MAX values respectively.

Multiplication of 64-bit unsigned or signed integers is only available on systems with 128-bit integers __{u}int64_t.