Commit 0ac06d77 authored by Max Kellermann's avatar Max Kellermann

PcmUtils: make PcmClamp() 64-bit-safe, add missing cast

parent 469e2334
......@@ -71,8 +71,8 @@ gcc_const
static inline T
PcmClamp(U x)
{
constexpr U MIN_VALUE = -(1 << (bits - 1));
constexpr U MAX_VALUE = (1 << (bits - 1)) - 1;
constexpr U MIN_VALUE = -(U(1) << (bits - 1));
constexpr U MAX_VALUE = (U(1) << (bits - 1)) - 1;
typedef std::numeric_limits<T> limits;
static_assert(MIN_VALUE >= limits::min(), "out of range");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment