MODULE SWAP
  USE ISO_FORTRAN_ENV, ONLY: REAL32, INT64, INT32
  IMPLICIT NONE

CONTAINS
  SUBROUTINE SWAP_I64(V1, V2)
    INTEGER(KIND=INT64), INTENT(INOUT) :: V1, V2
    ! Local temp
    INTEGER(KIND=INT64) :: TEMP
    TEMP = V1
    V1 = V2
    V2 = TEMP
  END SUBROUTINE SWAP_I64

  SUBROUTINE SWAP_I32(V1, V2)
    INTEGER(KIND=INT32), INTENT(INOUT) :: V1, V2
    ! Local temp
    INTEGER(KIND=INT32) :: TEMP
    TEMP = V1
    V1 = V2
    V2 = TEMP
  END SUBROUTINE SWAP_I32

  SUBROUTINE SWAP_R32(V1, V2)
    REAL(KIND=REAL32), INTENT(INOUT) :: V1, V2
    ! Local temp
    REAL(KIND=REAL32) :: TEMP
    TEMP = V1
    V1 = V2
    V2 = TEMP
  END SUBROUTINE SWAP_R32
END MODULE SWAP
