File: intrinsics_163.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (187 lines) | stat: -rw-r--r-- 4,143 bytes parent folder | download
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
program intrinsics_163

    integer :: x, y, size1
    integer(8) :: a, b, size2

    integer(kind=1) :: res_1
    integer(kind=2) :: res_2
    integer(kind=4) :: res_4
    integer(kind=8) :: res_8
 
    res_1 = ishftc(10_1, 2_1)
    print *, res_1
    if (res_1 /= 40) error stop
 
    res_1 = ishftc(10_1, -2_1)
    print *, res_1
    if (res_1 /= -126) error stop
 
    res_1 = ishftc(-10_1, 2_1)
    print *, res_1
    if (res_1 /= -37) error stop
 
    res_1 = ishftc(-10_1, -2_1)
    print *, res_1
    if (res_1 /= -67) error stop
 
    res_2 = ishftc(10_2, 2_2)
    print *, res_2
    if (res_2 /= 40) error stop
 
    res_2 = ishftc(10_2, -2_2)
    print *, res_2
    if (res_2 /= -32766) error stop
 
    res_2 = ishftc(-10_2, 2_2)
    print *, res_2
    if (res_2 /= -37) error stop
 
    res_2 = ishftc(-10_2, -2_2)
    print *, res_2
    if (res_2 /= -16387) error stop
 
    res_4 = ishftc(10_4, 2_4)
    print *, res_4
    if (res_4 /= 40) error stop
 
    res_4 = ishftc(10_4, -2_4)
    print *, res_4
    if (res_4 /= -2147483646) error stop
 
    res_4 = ishftc(-10_4, 2_4)
    print *, res_4
    if (res_4 /= -37) error stop
 
    res_4 = ishftc(-10_4, -2_4)
    print *, res_4
    if (res_4 /= -1073741827) error stop
 
    res_8 = ishftc(10_8, 2_8)
    print *, res_8
    if (res_8 /= 40_8) error stop
 
    res_8 = ishftc(10_8, -2_8)
    print *, res_8
    if (res_8 /= -9223372036854775806_8) error stop
 
    res_8 = ishftc(-10_8, 2_8)
    print *, res_8
    if (res_8 /= -37_8) error stop
 
 
    res_8 = ishftc(-10_8, -2_8)
    print *, res_8
    if (res_8 /= -4611686018427387907_8) error stop
 
    res_1 = ishftc(127_1, 7_1)
    print *, res_1
    if (res_1 /= -65) error stop
 
    res_1 = ishftc(127_1, -7_1)
    print *, res_1
    if (res_1 /= -2) error stop
 
    res_1 = ishftc(-127_1, 7_1)
    print *, res_1
    if (res_1 /= -64) error stop
 
    res_1 = ishftc(-127_1, -7_1)
    print *, res_1
    if (res_1 /= 3) error stop
 
    res_2 = ishftc(32767_2, 15_2)
    print *, res_2
    if (res_2 /= -16385) error stop
 
    res_2 = ishftc(32767_2, -15_2)
    print *, res_2
    if (res_2 /= -2) error stop
 
    res_2 = ishftc(-32767_2, 15_2)
    print *, res_2
    if (res_2 /= -16384) error stop
 
    res_2 = ishftc(-32767_2, -15_2)
    print *, res_2
    if (res_2 /= 3) error stop
 
    res_4 = ishftc(2147483647_4, 31_4)
    print *, res_4
    if (res_4 /= -1073741825) error stop
 
    res_4 = ishftc(2147483647_4, -31_4)
    print *, res_4
    if (res_4 /= -2) error stop
 
    res_4 = ishftc(-2147483647_4, 31_4)
    print *, res_4
    if (res_4 /= -1073741824) error stop
 
    res_4 = ishftc(-2147483647_4, -31_4)
    print *, res_4
    if (res_4 /= 3) error stop
 
    res_8 = ishftc(9223372036854775807_8, 63_8)
    print *, res_8
    if (res_8 /= -4611686018427387905_8) error stop
 
    res_8 = ishftc(9223372036854775807_8, -63_8)
    print *, res_8
    if (res_8 /= -2) error stop
 
    res_8 = ishftc(-9223372036854775807_8, 63_8)
    print *, res_8
    if (res_8 /= -4611686018427387904_8) error stop
 
    res_8 = ishftc(-9223372036854775807_8, -63_8)
    print *, res_8
    if (res_8 /= 3) error stop

    res_1 = ishftc(10_1, 2_1, 4_1)
    print *, res_1
    if (res_1 /= 10) error stop
 
    res_1 = ishftc(10_1, -2_1, 7_1)
    print *, res_1
    if (res_1 /= 66) error stop
 
    res_2 = ishftc(10_2, 2_2, 6_2)
    print *, res_2
    if (res_2 /= 40) error stop
 
    res_2 = ishftc(10_2, -2_2, 11_2)
    print *, res_2
    if (res_2 /= 1026) error stop

    res_4 = ishftc(10_4, 2_4, 13_4)
    print *, res_4
    if (res_4 /= 40) error stop
 
    res_4 = ishftc(10_4, -2_4, 31_4)
    print *, res_4
    if (res_4 /= 1073741826) error stop

 
    res_8 = ishftc(10_8, 2_8, 62_8)
    print *, res_8
    if (res_8 /= 40_8) error stop
 
    res_8 = ishftc(10_8, -2_8, 59_8)
    print *, res_8
    if (res_8 /= 288230376151711746_8) error stop

    x = 17
    y = 4
    size1 = 6

    a = 8
    b = 2
    size2 = 4

    print *, ishftc(a, b, size2)
    if (ishftc(a, b, size2) /= 2) error stop

    print *, ishftc(x, y, size1)
    if (ishftc(x, y, size1) /= 20) error stop

 end program