| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#line 453 "lib/PDL/PP.pm" |
|
3
|
|
|
|
|
|
|
/* |
|
4
|
|
|
|
|
|
|
* THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/IO/Misc.pd! Do not modify! |
|
5
|
|
|
|
|
|
|
*/ |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \ |
|
8
|
|
|
|
|
|
|
if (destroy) { \ |
|
9
|
|
|
|
|
|
|
comp_free_code \ |
|
10
|
|
|
|
|
|
|
} \ |
|
11
|
|
|
|
|
|
|
if ((trans)->dims_redone) { \ |
|
12
|
|
|
|
|
|
|
ntpriv_free_code \ |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
16
|
|
|
|
|
|
|
#include "perl.h" |
|
17
|
|
|
|
|
|
|
#include "XSUB.h" |
|
18
|
|
|
|
|
|
|
#include "pdl.h" |
|
19
|
|
|
|
|
|
|
#include "pdlcore.h" |
|
20
|
|
|
|
|
|
|
#define PDL PDL_IO_Misc |
|
21
|
|
|
|
|
|
|
extern Core* PDL; /* Structure hold core C functions */ |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#line 1857 "lib/PDL/PP.pm" |
|
24
|
|
|
|
|
|
|
pdl_error pdl_bswap2_redodims(pdl_trans *__privtrans) { |
|
25
|
|
|
|
|
|
|
pdl_error PDL_err = {0, NULL, 0}; |
|
26
|
|
|
|
|
|
|
#line 27 "lib/PDL/IO/Misc-pp-bswap2.c" |
|
27
|
|
|
|
|
|
|
#ifndef PDL_DECLARE_PARAMS_bswap2_0 |
|
28
|
|
|
|
|
|
|
#define PDL_DECLARE_PARAMS_bswap2_0(PDL_TYPE_OP,PDL_PPSYM_OP) \ |
|
29
|
|
|
|
|
|
|
PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 0, PDL_PPSYM_OP) |
|
30
|
|
|
|
|
|
|
#endif |
|
31
|
|
|
|
|
|
|
#define PDL_IF_BAD(t,f) f |
|
32
|
49
|
|
|
|
|
|
switch (__privtrans->__datatype) { /* Start generic switch */ |
|
33
|
0
|
|
|
|
|
|
case PDL_SB: { |
|
34
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_SByte,A) |
|
35
|
|
|
|
|
|
|
{if (sizeof(PDL_SByte) < 2) |
|
36
|
0
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_SByte)); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} break; |
|
39
|
0
|
|
|
|
|
|
case PDL_B: { |
|
40
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Byte,B) |
|
41
|
|
|
|
|
|
|
{if (sizeof(PDL_Byte) < 2) |
|
42
|
0
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Byte)); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} break; |
|
45
|
27
|
|
|
|
|
|
case PDL_S: { |
|
46
|
27
|
50
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Short,S) |
|
47
|
|
|
|
|
|
|
{if (sizeof(PDL_Short) < 2) |
|
48
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Short)); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
27
|
|
|
|
|
|
} break; |
|
51
|
22
|
|
|
|
|
|
case PDL_US: { |
|
52
|
22
|
50
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Ushort,U) |
|
53
|
|
|
|
|
|
|
{if (sizeof(PDL_Ushort) < 2) |
|
54
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Ushort)); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
22
|
|
|
|
|
|
} break; |
|
57
|
0
|
|
|
|
|
|
case PDL_L: { |
|
58
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Long,L) |
|
59
|
|
|
|
|
|
|
{if (sizeof(PDL_Long) < 2) |
|
60
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Long)); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
0
|
|
|
|
|
|
} break; |
|
63
|
0
|
|
|
|
|
|
case PDL_UL: { |
|
64
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_ULong,K) |
|
65
|
|
|
|
|
|
|
{if (sizeof(PDL_ULong) < 2) |
|
66
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_ULong)); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
0
|
|
|
|
|
|
} break; |
|
69
|
0
|
|
|
|
|
|
case PDL_IND: { |
|
70
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Indx,N) |
|
71
|
|
|
|
|
|
|
{if (sizeof(PDL_Indx) < 2) |
|
72
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Indx)); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
0
|
|
|
|
|
|
} break; |
|
75
|
0
|
|
|
|
|
|
case PDL_ULL: { |
|
76
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_ULongLong,P) |
|
77
|
|
|
|
|
|
|
{if (sizeof(PDL_ULongLong) < 2) |
|
78
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_ULongLong)); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
0
|
|
|
|
|
|
} break; |
|
81
|
0
|
|
|
|
|
|
case PDL_LL: { |
|
82
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_LongLong,Q) |
|
83
|
|
|
|
|
|
|
{if (sizeof(PDL_LongLong) < 2) |
|
84
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_LongLong)); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
0
|
|
|
|
|
|
} break; |
|
87
|
0
|
|
|
|
|
|
case PDL_F: { |
|
88
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Float,F) |
|
89
|
|
|
|
|
|
|
{if (sizeof(PDL_Float) < 2) |
|
90
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Float)); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
|
|
|
|
|
} break; |
|
93
|
0
|
|
|
|
|
|
case PDL_D: { |
|
94
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_Double,D) |
|
95
|
|
|
|
|
|
|
{if (sizeof(PDL_Double) < 2) |
|
96
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_Double)); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
0
|
|
|
|
|
|
} break; |
|
99
|
0
|
|
|
|
|
|
case PDL_LD: { |
|
100
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_0(PDL_LDouble,E) |
|
101
|
|
|
|
|
|
|
{if (sizeof(PDL_LDouble) < 2) |
|
102
|
|
|
|
|
|
|
return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "Tried to bswap size 2 but data type only %zd bytes",sizeof(PDL_LDouble)); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
0
|
|
|
|
|
|
} break; |
|
105
|
0
|
|
|
|
|
|
default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in bswap2: unhandled datatype(%d), only handles (ABSULKNPQFDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
#undef PDL_IF_BAD |
|
108
|
|
|
|
|
|
|
|
|
109
|
49
|
50
|
|
|
|
|
PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans)); |
|
110
|
49
|
|
|
|
|
|
return PDL_err; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#line 1857 "lib/PDL/PP.pm" |
|
115
|
|
|
|
|
|
|
pdl_error pdl_bswap2_readdata(pdl_trans *__privtrans) { |
|
116
|
|
|
|
|
|
|
pdl_error PDL_err = {0, NULL, 0}; |
|
117
|
|
|
|
|
|
|
#line 118 "lib/PDL/IO/Misc-pp-bswap2.c" |
|
118
|
49
|
50
|
|
|
|
|
if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in bswap2:" "broadcast.incs NULL"); |
|
119
|
|
|
|
|
|
|
/* broadcastloop declarations */ |
|
120
|
|
|
|
|
|
|
int __brcloopval; |
|
121
|
|
|
|
|
|
|
register PDL_Indx __tind0,__tind1; /* counters along dim */ |
|
122
|
49
|
|
|
|
|
|
register PDL_Indx __tnpdls = __privtrans->broadcast.npdls; |
|
123
|
|
|
|
|
|
|
/* dims here are how many steps along those dims */ |
|
124
|
49
|
|
|
|
|
|
register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0); |
|
125
|
49
|
|
|
|
|
|
register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1); |
|
126
|
|
|
|
|
|
|
#define PDL_BROADCASTLOOP_START_bswap2_readdata PDL_BROADCASTLOOP_START( \ |
|
127
|
|
|
|
|
|
|
readdata, \ |
|
128
|
|
|
|
|
|
|
__privtrans->broadcast, \ |
|
129
|
|
|
|
|
|
|
__privtrans->vtable, \ |
|
130
|
|
|
|
|
|
|
x_datap += __offsp[0]; \ |
|
131
|
|
|
|
|
|
|
, \ |
|
132
|
|
|
|
|
|
|
( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \ |
|
133
|
|
|
|
|
|
|
), \ |
|
134
|
|
|
|
|
|
|
( ,x_datap += __tinc0_x \ |
|
135
|
|
|
|
|
|
|
) \ |
|
136
|
|
|
|
|
|
|
) |
|
137
|
|
|
|
|
|
|
#define PDL_BROADCASTLOOP_END_bswap2_readdata PDL_BROADCASTLOOP_END( \ |
|
138
|
|
|
|
|
|
|
__privtrans->broadcast, \ |
|
139
|
|
|
|
|
|
|
x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \ |
|
140
|
|
|
|
|
|
|
) |
|
141
|
|
|
|
|
|
|
#ifndef PDL_DECLARE_PARAMS_bswap2_1 |
|
142
|
|
|
|
|
|
|
#define PDL_DECLARE_PARAMS_bswap2_1(PDL_TYPE_OP,PDL_PPSYM_OP) \ |
|
143
|
|
|
|
|
|
|
PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) |
|
144
|
|
|
|
|
|
|
#endif |
|
145
|
|
|
|
|
|
|
#define PDL_IF_BAD(t,f) f |
|
146
|
49
|
|
|
|
|
|
switch (__privtrans->__datatype) { /* Start generic switch */ |
|
147
|
0
|
|
|
|
|
|
case PDL_SB: { |
|
148
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_SByte,A) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
151
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
152
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
153
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
154
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
155
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
156
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
} break; |
|
160
|
0
|
|
|
|
|
|
case PDL_B: { |
|
161
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Byte,B) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
164
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
165
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
166
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
167
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
168
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
169
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
|
} break; |
|
173
|
27
|
|
|
|
|
|
case PDL_S: { |
|
174
|
27
|
50
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Short,S) |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
175
|
186
|
50
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
176
|
98
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
177
|
98
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
178
|
196
|
100
|
|
|
|
|
for (i=0;i
|
|
179
|
98
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
180
|
98
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
181
|
98
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
182
|
98
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
27
|
50
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
50
|
|
|
|
|
|
|
185
|
27
|
|
|
|
|
|
} break; |
|
186
|
22
|
|
|
|
|
|
case PDL_US: { |
|
187
|
22
|
50
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Ushort,U) |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
188
|
131655
|
50
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
189
|
130968
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
190
|
130968
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
191
|
261936
|
100
|
|
|
|
|
for (i=0;i
|
|
192
|
130968
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
193
|
130968
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
194
|
130968
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
195
|
130968
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
196
|
|
|
|
|
|
|
} |
|
197
|
37
|
50
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
100
|
|
|
|
|
|
|
198
|
22
|
|
|
|
|
|
} break; |
|
199
|
0
|
|
|
|
|
|
case PDL_L: { |
|
200
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Long,L) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
203
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
204
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
205
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
206
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
207
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
208
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
} break; |
|
212
|
0
|
|
|
|
|
|
case PDL_UL: { |
|
213
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_ULong,K) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
214
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
216
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
217
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
218
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
219
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
220
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
221
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
} break; |
|
225
|
0
|
|
|
|
|
|
case PDL_IND: { |
|
226
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Indx,N) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
227
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
229
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
230
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
231
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
232
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
233
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
234
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
} break; |
|
238
|
0
|
|
|
|
|
|
case PDL_ULL: { |
|
239
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_ULongLong,P) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
240
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
242
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
243
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
244
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
245
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
246
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
247
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
} break; |
|
251
|
0
|
|
|
|
|
|
case PDL_LL: { |
|
252
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_LongLong,Q) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
253
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
255
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
256
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
257
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
258
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
259
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
260
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
} break; |
|
264
|
0
|
|
|
|
|
|
case PDL_F: { |
|
265
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Float,F) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
266
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
268
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
269
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
270
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
271
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
272
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
273
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
274
|
|
|
|
|
|
|
} |
|
275
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
} break; |
|
277
|
0
|
|
|
|
|
|
case PDL_D: { |
|
278
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_Double,D) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
279
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
281
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
282
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
283
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
284
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
285
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
286
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
} break; |
|
290
|
0
|
|
|
|
|
|
case PDL_LD: { |
|
291
|
0
|
0
|
|
|
|
|
PDL_DECLARE_PARAMS_bswap2_1(PDL_LDouble,E) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
292
|
0
|
0
|
|
|
|
|
PDL_BROADCASTLOOP_START_bswap2_readdata {int i; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
|
int n = sizeof((x_datap)[0]) / 2; |
|
294
|
0
|
|
|
|
|
|
struct {char n[2];} *aa = (void *) &(x_datap)[0]; |
|
295
|
0
|
0
|
|
|
|
|
for (i=0;i
|
|
296
|
0
|
|
|
|
|
|
struct {char n[2];} bb; memcpy(&bb, aa+i, 2); |
|
297
|
0
|
|
|
|
|
|
PDL_Byte *a = (PDL_Byte*) (void*) (aa+i); |
|
298
|
0
|
|
|
|
|
|
PDL_Byte *b = (PDL_Byte*) &bb; |
|
299
|
0
|
|
|
|
|
|
a[0] = b[1]; a[1] = b[0]; |
|
300
|
|
|
|
|
|
|
} |
|
301
|
0
|
0
|
|
|
|
|
}PDL_BROADCASTLOOP_END_bswap2_readdata |
|
|
|
0
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
|
} break; |
|
303
|
0
|
|
|
|
|
|
default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in bswap2: unhandled datatype(%d), only handles (ABSULKNPQFDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
#undef PDL_IF_BAD |
|
306
|
49
|
|
|
|
|
|
return PDL_err; |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
static pdl_datatypes pdl_bswap2_vtable_gentypes[] = { PDL_SB, PDL_B, PDL_S, PDL_US, PDL_L, PDL_UL, PDL_IND, PDL_ULL, PDL_LL, PDL_F, PDL_D, PDL_LD, -1 }; |
|
310
|
|
|
|
|
|
|
static PDL_Indx pdl_bswap2_vtable_realdims[] = { 0 }; |
|
311
|
|
|
|
|
|
|
static char *pdl_bswap2_vtable_parnames[] = { "x" }; |
|
312
|
|
|
|
|
|
|
static short pdl_bswap2_vtable_parflags[] = { |
|
313
|
|
|
|
|
|
|
PDL_PARAM_ISWRITE |
|
314
|
|
|
|
|
|
|
}; |
|
315
|
|
|
|
|
|
|
static pdl_datatypes pdl_bswap2_vtable_partypes[] = { -1 }; |
|
316
|
|
|
|
|
|
|
static PDL_Indx pdl_bswap2_vtable_realdims_starts[] = { 0 }; |
|
317
|
|
|
|
|
|
|
static PDL_Indx pdl_bswap2_vtable_realdims_ind_ids[] = { 0 }; |
|
318
|
|
|
|
|
|
|
static char *pdl_bswap2_vtable_indnames[] = { "" }; |
|
319
|
|
|
|
|
|
|
pdl_transvtable pdl_bswap2_vtable = { |
|
320
|
|
|
|
|
|
|
PDL_TRANS_DO_BROADCAST, 0, pdl_bswap2_vtable_gentypes, 0, 1, NULL /*CORE21*/, |
|
321
|
|
|
|
|
|
|
pdl_bswap2_vtable_realdims, pdl_bswap2_vtable_parnames, |
|
322
|
|
|
|
|
|
|
pdl_bswap2_vtable_parflags, pdl_bswap2_vtable_partypes, |
|
323
|
|
|
|
|
|
|
pdl_bswap2_vtable_realdims_starts, pdl_bswap2_vtable_realdims_ind_ids, 0, |
|
324
|
|
|
|
|
|
|
0, pdl_bswap2_vtable_indnames, |
|
325
|
|
|
|
|
|
|
pdl_bswap2_redodims, pdl_bswap2_readdata, NULL, |
|
326
|
|
|
|
|
|
|
NULL, |
|
327
|
|
|
|
|
|
|
0,"PDL::IO::Misc::bswap2" |
|
328
|
|
|
|
|
|
|
}; |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
|
331
|
49
|
|
|
|
|
|
pdl_error pdl_run_bswap2(pdl *x) { |
|
332
|
49
|
|
|
|
|
|
pdl_error PDL_err = {0, NULL, 0}; |
|
333
|
49
|
50
|
|
|
|
|
if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
|
334
|
49
|
|
|
|
|
|
pdl_trans *__privtrans = PDL->create_trans(&pdl_bswap2_vtable); |
|
335
|
49
|
50
|
|
|
|
|
if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
|
336
|
49
|
|
|
|
|
|
__privtrans->pdls[0] = x; |
|
337
|
49
|
50
|
|
|
|
|
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
|
338
|
49
|
50
|
|
|
|
|
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
|
339
|
49
|
|
|
|
|
|
return PDL_err; |
|
340
|
|
|
|
|
|
|
} |