b64_encode_R8_a Subroutine

private pure subroutine b64_encode_R8_a(n, code)

Arguments

TypeIntentOptionalAttributesName
real(kind=R8P), intent(in) :: n(1:)
character(len=:), intent(out), allocatable:: code

Calls

proc~~b64_encode_r8_a~4~~CallsGraph proc~b64_encode_r8_a~4 b64_encode_R8_a proc~encode_bits~4 encode_bits proc~b64_encode_r8_a~4->proc~encode_bits~4

Called by

proc~~b64_encode_r8_a~4~~CalledByGraph proc~b64_encode_r8_a~4 b64_encode_R8_a proc~b64_encode_up_a~4 b64_encode_up_a proc~b64_encode_up_a~4->proc~b64_encode_r8_a~4 interface~b64_encode~4 b64_encode interface~b64_encode~4->proc~b64_encode_r8_a~4 interface~b64_encode_up~4 b64_encode_up interface~b64_encode_up~4->proc~b64_encode_up_a~4 interface~b64_encode_up~4->proc~b64_encode_up_a~4 interface~b64_encode_up~4->interface~b64_encode_up~4 interface~b64_encode_up~4->interface~b64_encode_up~4

Contents

Source Code


Source Code

   pure subroutine b64_encode_R8_a(n, code)
   !< Encode array numbers to base64 (R8P).
   !<
   !<```fortran
   !< use befor64
   !< use penf
   !< character(len=:), allocatable :: code64
   !< call b64_encode(n=[1._R8P,2._R8P], code=code64)
   !< print "(A)", code64
   !<```
   !=> AAAAAAAA8D8AAAAAAAAAQA== <<<
   real(R8P),                     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*BYR8P+2)/3)*3)) ; nI1P = 0_I1P
   code = repeat(' ',((ns*BYR8P+2)/3)*4)
   nI1P = transfer(n,nI1P)
   padd = mod((ns*BYR8P),3_I8P) ; if (padd>0_I4P) padd = 3_I4P - padd
   call encode_bits(bits=nI1P,padd=padd,code=code)
   endsubroutine b64_encode_R8_a