Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Improve type correctness in scale_and_offset.
Avoid integer overflow when determining the range of a signed integer type (e.g. INT_MAX - INT_MIN) in the scale_and_offset<>() functor by taking advantage of the fact that the range for the corresponding unsigned integer type is the same, e.g. (INT_MAX - INT_MIN) == (UINTMAX - UINT_MIN). The previous implementation relied on converting the integer values to floating point values before performing the subtraction, which introduced potential inaccuracies.
- Loading branch information