Rotate the low 32 bits of x right by rot bits, 0 <= rot <= 31.
Branch free: when rot is zero the left-shifted term is shifted clean
out of the low 32 bits and the mask removes it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | x | |||
| integer(kind=int64), | intent(in) | :: | rot |
pure function rotate_right32(x, rot) result(r) !! Rotate the low 32 bits of `x` right by `rot` bits, `0 <= rot <= 31`. !! Branch free: when `rot` is zero the left-shifted term is shifted clean !! out of the low 32 bits and the mask removes it. integer(int64), intent(in) :: x integer(int64), intent(in) :: rot integer(int64) :: r r = ior(ibits(x, int(rot, default_int), int(32 - rot, default_int)), & iand(ishft(iand(x, MASK32), int(32 - rot, default_int)), MASK32)) end function rotate_right32