Skip to content

Instantly share code, notes, and snippets.

@DSCF-1224
Created November 14, 2020 04:37
Show Gist options
  • Save DSCF-1224/09a5ca2de17b946a3f3f7d79ac81e431 to your computer and use it in GitHub Desktop.
Save DSCF-1224/09a5ca2de17b946a3f3f7d79ac81e431 to your computer and use it in GitHub Desktop.
2個の32bit整数から1個の64bit整数を作成する
program memorandum
use, intrinsic :: iso_fortran_env
implicit none
integer(INT32) :: input_front = -17_INT32
integer(INT32) :: input_rear = +32_INT32
integer(INT64) :: retval
! operation
retval = ior(i=Z'FFFFFFFF00000000', j=input_front)
retval = ishftc(i= retval, shift=32)
retval = iand(i=retval, j=ior(i=Z'FFFFFFFF00000000', j=input_rear))
! show the result
print '(1B64.64)', retval
print '(2B32.32)', input_front, input_rear
end program memorandum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment