libdevice User's Guide (PDF) - v9.2.148 (older) - Last updated June 12, 2018 - Send Feedback

## 3.258. __nv_rhadd

Prototype:

    i32 @__nv_rhadd(i32 %x, i32 %y)

Description:

Compute average of signed input arguments `x` and `y` as ( `x` + `y` + 1 ) >> 1, avoiding overflow in the intermediate sum.

Returns:

Returns a signed integer value representing the signed rounded average value of the two inputs.

Library Availability:

Compute 2.0: Yes

Compute 3.0: Yes

Compute 3.5: Yes