File: swap_bytes8.F

package info (click to toggle)
emoslib 000382%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 49,276 kB
  • sloc: fortran: 90,253; ansic: 26,730; makefile: 417; sh: 388; f90: 276
file content (40 lines) | stat: -rwxr-xr-x 904 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
C Copyright 1981-2007 ECMWF
C 
C Licensed under the GNU Lesser General Public License which
C incorporates the terms and conditions of version 3 of the GNU
C General Public License.
C See LICENSE and gpl-3.0.txt for details.
C

      subroutine swap_bytes8(r1,r2)
c     ---------------------------------
      implicit none

      real*8 r1, r2
      real*8 r18
      real*8 r28
      integer*8 kint18,kint28

      equivalence(r18,kint18)
      equivalence(r28,kint28)



c Reverse order of bytes

      r18=r1

      call mvbits(kint18, 56, 8, kint28, 0)
      call mvbits(kint18, 48, 8, kint28, 8)
      call mvbits(kint18, 40, 8, kint28,16)
      call mvbits(kint18, 32, 8, kint28,24)
      call mvbits(kint18, 24, 8, kint28,32)
      call mvbits(kint18, 16, 8, kint28,40)
      call mvbits(kint18,  8, 8, kint28,48)
      call mvbits(kint18,  0, 8, kint28,56)


      r2=r28

      return
      end