b64_encode_R16_a Subroutine

private pure subroutine b64_encode_R16_a(n, code)

Arguments

Type IntentOptional AttributesName
real(kind=R16P), intent(in) :: n(1:)

Array of numbers to be encoded.

character(len=:), intent(out), allocatable:: code

Encoded array.

Description

Encode array numbers to base64 (R16P).

Calls

proc~~b64_encode_r16_a~~CallsGraph proc~b64_encode_r16_a b64_encode_R16_a proc~encode_bits encode_bits proc~b64_encode_r16_a->proc~encode_bits
Help

Variables

TypeVisibility AttributesNameInitial
integer(kind=I1P), public, allocatable:: nI1P(:)

One byte integer array containing n.

integer(kind=I4P), public :: padd

Number of padding characters ('=').

integer(kind=I8P), public :: ns

Size of n.


Source Code

  pure subroutine b64_encode_R16_a(n, code)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Encode array numbers to base64 (R16P).
  !---------------------------------------------------------------------------------------------------------------------------------
  real(R16P),                    intent(in)  :: n(1:)   !< Array of numbers to be encoded.
  character(len=:), allocatable, intent(out) :: code    !< Encoded array.
  integer(I1P),     allocatable              :: nI1P(:) !< One byte integer array containing n.
  integer(I4P)                               :: padd    !< Number of padding characters ('=').
  integer(I8P)                               :: ns      !< Size of n.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  ns = size(n,dim=1)
  allocate(nI1P(1:((ns*BYR16P+2)/3)*3)) ; nI1P = 0_I1P
  code = repeat(' ',((ns*BYR16P+2)/3)*4)
  nI1P = transfer(n,nI1P)
  padd = mod((ns*BYR16P),3_I8P) ; if (padd>0_I4P) padd = 3_I4P - padd
  call encode_bits(bits=nI1P,padd=padd,code=code)
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine b64_encode_R16_a