Use ClampTo in RXCompressUint to fix narrowing warning

This commit is contained in:
Jonathan G Rennison 2024-08-29 21:06:04 +01:00
parent 8f5f4326ac
commit ed3e401d06

View File

@ -135,7 +135,7 @@ uint16_t RXCompressUint(uint32_t num)
{
if (num <= 0x100) return num;
if (num <= 0x7900) return 0x100 + ((num - 0x100) >> 3);
return std::min<uint32_t>(UINT16_MAX, 0x1000 + ((num - 0x7900) >> 6));
return ClampTo<uint16_t>(0x1000 + ((num - 0x7900) >> 6));
}
/**