23 module native_endianness
26 use kinds,
only: i_byte,i_long
32 public is_little_endian
39 logical function is_little_endian()
58 is_little_endian = (i1 == i2)
60 end function is_little_endian
62 end module native_endianness
68 subroutine to_native_endianness_i4(i4,num)
82 use kinds,
only: i_byte,i_long,i_llong
85 integer(i_llong),
intent(in) :: num
86 integer(i_long),
intent(inout) :: i4(num)
88 integer(i_byte),
dimension(4) :: byte_arr, byte_arr_tmp
89 integer(i_long) :: i,n
92 byte_arr_tmp = transfer(i4(n), byte_arr)
93 byte_arr(1)=byte_arr_tmp(4)
94 byte_arr(2)=byte_arr_tmp(3)
95 byte_arr(3)=byte_arr_tmp(2)
96 byte_arr(4)=byte_arr_tmp(1)
97 i4(n) = transfer(byte_arr, i4(n))
102 end subroutine to_native_endianness_i4