On 4/17/20 2:24 PM, Richard Henderson wrote:
> On 4/17/20 9:22 AM, Stephen Long wrote:
>> +#define DO_RADDHN(N, M, SH) ((N + M + (1 << (SH - 1))) >> SH)
> 
> This formula will overflow.  See DO_RSHR -- with some added parenthesis, we
> could actually reuse that macro.

My bad.  While it does overflow, all of these operations are truncating not
saturating, and moreover truncate to halfesize bits.  Therefore overflow
doesn't matter.


r~

Reply via email to