Compute the number of bytes of an integer variable.
use penf
print FI1P, byte_size(1_I4P)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4P), | intent(in) | :: | i |
Integer variable whose number of bytes must be computed. |
Number of bytes of i.
elemental function byte_size_I4P(i) result(bytes) !< Compute the number of bytes of an integer variable. !< !<```fortran !< use penf !< print FI1P, byte_size(1_I4P) !<``` !=> 4 <<< integer(I4P), intent(in) :: i !< Integer variable whose number of bytes must be computed. integer(I1P) :: bytes !< Number of bytes of i. bytes = bit_size(i) / 8_I1P endfunction byte_size_I4P