On Monday, 22 July 2013 at 11:56:35 UTC, Regan Heath wrote:
If we were to design the perfect type for representing a size
or length it would hold the maximum value of an unsigned int,
but would not undeflow to max unsigned int, instead it would
truncate.
This type would have to be built on top of the existing
primitives and would therefore be less performant, which is a
shame and likely the reason it doesn't already exist.
R
ARM directly supports saturating arithmetic, so this approach
could be both practical and fast. However, x86 only supports it
in SIMD, so it's not ideal.