Clamp to 0 to 255, so a caller’s arithmetic slip cannot emit a sequence the terminal will misparse.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | value |
pure function clamp_byte(value) result(r) !! Clamp to 0 to 255, so a caller's arithmetic slip cannot emit a !! sequence the terminal will misparse. integer(int32), intent(in) :: value integer(int32) :: r r = max(0_int32, min(255_int32, value)) end function clamp_byte