clamp_byte Function

private 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.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: value

Return Value integer(kind=int32)


Called by

proc~~clamp_byte~~CalledByGraph proc~clamp_byte clamp_byte proc~ansi_bg_256 ansi_bg_256 proc~ansi_bg_256->proc~clamp_byte proc~ansi_bg_rgb ansi_bg_rgb proc~ansi_bg_rgb->proc~clamp_byte proc~ansi_fg_256 ansi_fg_256 proc~ansi_fg_256->proc~clamp_byte proc~ansi_fg_rgb ansi_fg_rgb proc~ansi_fg_rgb->proc~clamp_byte

Source Code

   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