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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| C
C **********************************************************************
C
Subroutine U008(A,J,Bout)
C
C **********************************************************************
C
C Bibliothèque JMBPack
C
C Série U: Utilitaires
C
C **********************************************************************
C
C Routine U008: Décomposition d'un nombre réel sur 4 octets
C
C Version 1.0, Jean-Marc Blanc, décembre 2011
C
C **********************************************************************
C
C Un nombre réel mémorisé sur 4 octets est décomposé en une
C suite de 32 entiers valant 0 ou 1.
C
C **********************************************************************
C
Implicit None
C
Real*4 A
Integer*1 J(4,8)
Logical Bout
C
C A l'entrée:
C
C A Le nombre à décomposer.
C
C Bout Boutisme
C Vrai Grand à la fin (big endian)
C Faux Petit à la fin (little endian)
C
C A la sortie:
C
C J Les 32 bits contenant le nombre décomposé.
C
C **********************************************************************
C
Real*4 AA
Integer*1 K,L(4)
Equivalence (AA,L)
C
AA=A
If (Bout) Then
Do K=1,8
If (BTest(L(1),8-K)) Then
J(1,K)=1
Else
J(1,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(2),8-K)) Then
J(2,K)=1
Else
J(2,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(3),8-K)) Then
J(3,K)=1
Else
J(3,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(4),8-K)) Then
J(4,K)=1
Else
J(4,K)=0
End If
End Do
C
Else
Do K=1,8
If (BTest(L(4),8-K)) Then
J(4,K)=1
Else
J(4,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(3),8-K)) Then
J(3,K)=1
Else
J(3,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(2),8-K)) Then
J(2,K)=1
Else
J(2,K)=0
End If
End Do
C
Do K=1,8
If (BTest(L(1),8-K)) Then
J(1,K)=1
Else
J(1,K)=0
End If
End Do
End If
C
Return
End |
Partager