line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#ifdef __MINGW32__ |
3
|
|
|
|
|
|
|
#ifndef __USE_MINGW_ANSI_STDIO |
4
|
|
|
|
|
|
|
#define __USE_MINGW_ANSI_STDIO 1 |
5
|
|
|
|
|
|
|
#endif |
6
|
|
|
|
|
|
|
#endif |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT 1 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "EXTERN.h" |
11
|
|
|
|
|
|
|
#include "perl.h" |
12
|
|
|
|
|
|
|
#include "XSUB.h" |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#include "math_ryu_include.h" |
15
|
|
|
|
|
|
|
#include "ryu_headers/ryu.h" |
16
|
|
|
|
|
|
|
#include "ryu_headers/ryu_parse.h" |
17
|
|
|
|
|
|
|
#include "ryu_headers/common.h" |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
/* s2d */ |
20
|
|
|
|
|
|
|
|
21
|
4181
|
|
|
|
|
|
NV M_RYU_s2d(char * buffer) { |
22
|
|
|
|
|
|
|
NV nv; |
23
|
4181
|
|
|
|
|
|
s2d(buffer, &nv); |
24
|
4181
|
|
|
|
|
|
return nv; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
/* End s2d */ |
28
|
|
|
|
|
|
|
/* d2s */ |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
|
void M_RYU_d2s_buffered_n(pTHX_ SV * nv) { |
31
|
7
|
|
|
|
|
|
dXSARGS; |
32
|
|
|
|
|
|
|
int n; |
33
|
|
|
|
|
|
|
char * result; |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
|
Newxz(result, D_BUF, char); |
36
|
|
|
|
|
|
|
|
37
|
7
|
50
|
|
|
|
|
n = d2s_buffered_n(SvNV(nv), result); |
38
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
39
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
40
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
|
Safefree(result); |
42
|
7
|
|
|
|
|
|
XSRETURN(2); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
7
|
|
|
|
|
|
SV * M_RYU_d2s_buffered(pTHX_ SV * nv) { |
46
|
|
|
|
|
|
|
char * result; |
47
|
|
|
|
|
|
|
SV * outsv; |
48
|
|
|
|
|
|
|
|
49
|
7
|
|
|
|
|
|
Newxz(result, D_BUF, char); |
50
|
|
|
|
|
|
|
|
51
|
7
|
50
|
|
|
|
|
d2s_buffered(SvNV(nv), result); |
52
|
|
|
|
|
|
|
|
53
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
54
|
7
|
|
|
|
|
|
Safefree(result); |
55
|
7
|
|
|
|
|
|
return outsv; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
2103
|
|
|
|
|
|
SV * M_RYU_d2s(pTHX_ SV * nv) { |
59
|
2103
|
50
|
|
|
|
|
return newSVpv(d2s(SvNV(nv)), 0); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
/* End d2s */ |
63
|
|
|
|
|
|
|
/* d2fixed */ |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
|
void M_RYU_d2fixed_buffered_n(pTHX_ SV * nv, SV * prec) { |
66
|
7
|
|
|
|
|
|
dXSARGS; |
67
|
|
|
|
|
|
|
int n; |
68
|
|
|
|
|
|
|
char * result; |
69
|
|
|
|
|
|
|
|
70
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(prec), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
7
|
50
|
|
|
|
|
n = d2fixed_buffered_n(SvNV(nv), SvUV(prec), result); |
|
|
50
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
75
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
76
|
7
|
|
|
|
|
|
Safefree(result); |
77
|
7
|
|
|
|
|
|
XSRETURN(2); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
7
|
|
|
|
|
|
SV * M_RYU_d2fixed_buffered(pTHX_ SV * nv, SV * prec) { |
81
|
|
|
|
|
|
|
char * result; |
82
|
|
|
|
|
|
|
SV * outsv; |
83
|
|
|
|
|
|
|
|
84
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(prec), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
7
|
50
|
|
|
|
|
d2fixed_buffered(SvNV(nv), SvUV(prec), result); |
|
|
50
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
89
|
7
|
|
|
|
|
|
Safefree(result); |
90
|
7
|
|
|
|
|
|
return outsv; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
21
|
|
|
|
|
|
SV * M_RYU_d2fixed(pTHX_ SV * nv, SV * prec) { |
94
|
21
|
50
|
|
|
|
|
return newSVpv(d2fixed(SvNV(nv), SvUV(prec)), 0); |
|
|
50
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
/*End d2fixed */ |
98
|
|
|
|
|
|
|
/* d2exp */ |
99
|
|
|
|
|
|
|
|
100
|
7
|
|
|
|
|
|
void M_RYU_d2exp_buffered_n(pTHX_ SV * nv, SV * exponent) { |
101
|
7
|
|
|
|
|
|
dXSARGS; |
102
|
|
|
|
|
|
|
int n; |
103
|
|
|
|
|
|
|
char * result; |
104
|
|
|
|
|
|
|
|
105
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(exponent), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
7
|
50
|
|
|
|
|
n = d2exp_buffered_n(SvNV(nv), SvUV(exponent), result); |
|
|
50
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
110
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
111
|
7
|
|
|
|
|
|
Safefree(result); |
112
|
7
|
|
|
|
|
|
XSRETURN(2); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
7
|
|
|
|
|
|
SV * M_RYU_d2exp_buffered(pTHX_ SV * nv, SV * exponent) { |
116
|
|
|
|
|
|
|
char * result; |
117
|
|
|
|
|
|
|
SV * outsv; |
118
|
|
|
|
|
|
|
|
119
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(exponent), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
7
|
50
|
|
|
|
|
d2exp_buffered(SvNV(nv), SvUV(exponent), result); |
|
|
50
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
124
|
7
|
|
|
|
|
|
Safefree(result); |
125
|
7
|
|
|
|
|
|
return outsv; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
21
|
|
|
|
|
|
SV * M_RYU_d2exp(pTHX_ SV * nv, SV * exponent) { |
129
|
21
|
50
|
|
|
|
|
return newSVpv(d2exp(SvNV(nv), SvUV(exponent)), 0); |
|
|
50
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
1
|
|
|
|
|
|
int _sis_perl_version(void) { |
133
|
1
|
|
|
|
|
|
return SIS_PERL_VERSION; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
|
int M_RYU__has_uint128(void) { |
137
|
1
|
|
|
|
|
|
return _has_uint128(); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
/* End d2exp */ |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
MODULE = Math::Ryu PACKAGE = Math::Ryu PREFIX = M_RYU_ |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
NV |
149
|
|
|
|
|
|
|
M_RYU_s2d (buffer) |
150
|
|
|
|
|
|
|
char * buffer |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
void |
153
|
|
|
|
|
|
|
M_RYU_d2s_buffered_n (nv) |
154
|
|
|
|
|
|
|
SV * nv |
155
|
|
|
|
|
|
|
PREINIT: |
156
|
|
|
|
|
|
|
I32* temp; |
157
|
|
|
|
|
|
|
PPCODE: |
158
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
159
|
7
|
|
|
|
|
|
M_RYU_d2s_buffered_n(aTHX_ nv); |
160
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
161
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
162
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
163
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
166
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
SV * |
169
|
|
|
|
|
|
|
M_RYU_d2s_buffered (nv) |
170
|
|
|
|
|
|
|
SV * nv |
171
|
|
|
|
|
|
|
CODE: |
172
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2s_buffered (aTHX_ nv); |
173
|
|
|
|
|
|
|
OUTPUT: RETVAL |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
SV * |
176
|
|
|
|
|
|
|
M_RYU_d2s (nv) |
177
|
|
|
|
|
|
|
SV * nv |
178
|
|
|
|
|
|
|
CODE: |
179
|
2103
|
|
|
|
|
|
RETVAL = M_RYU_d2s (aTHX_ nv); |
180
|
|
|
|
|
|
|
OUTPUT: RETVAL |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
void |
183
|
|
|
|
|
|
|
M_RYU_d2fixed_buffered_n (nv, prec) |
184
|
|
|
|
|
|
|
SV * nv |
185
|
|
|
|
|
|
|
SV * prec |
186
|
|
|
|
|
|
|
PREINIT: |
187
|
|
|
|
|
|
|
I32* temp; |
188
|
|
|
|
|
|
|
PPCODE: |
189
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
190
|
7
|
|
|
|
|
|
M_RYU_d2fixed_buffered_n(aTHX_ nv, prec); |
191
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
192
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
193
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
194
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
197
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
SV * |
200
|
|
|
|
|
|
|
M_RYU_d2fixed_buffered (nv, prec) |
201
|
|
|
|
|
|
|
SV * nv |
202
|
|
|
|
|
|
|
SV * prec |
203
|
|
|
|
|
|
|
CODE: |
204
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2fixed_buffered (aTHX_ nv, prec); |
205
|
|
|
|
|
|
|
OUTPUT: RETVAL |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
SV * |
208
|
|
|
|
|
|
|
M_RYU_d2fixed (nv, prec) |
209
|
|
|
|
|
|
|
SV * nv |
210
|
|
|
|
|
|
|
SV * prec |
211
|
|
|
|
|
|
|
CODE: |
212
|
21
|
|
|
|
|
|
RETVAL = M_RYU_d2fixed (aTHX_ nv, prec); |
213
|
|
|
|
|
|
|
OUTPUT: RETVAL |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
void |
216
|
|
|
|
|
|
|
M_RYU_d2exp_buffered_n (nv, exponent) |
217
|
|
|
|
|
|
|
SV * nv |
218
|
|
|
|
|
|
|
SV * exponent |
219
|
|
|
|
|
|
|
PREINIT: |
220
|
|
|
|
|
|
|
I32* temp; |
221
|
|
|
|
|
|
|
PPCODE: |
222
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
223
|
7
|
|
|
|
|
|
M_RYU_d2exp_buffered_n(aTHX_ nv, exponent); |
224
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
225
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
226
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
227
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
230
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
SV * |
233
|
|
|
|
|
|
|
M_RYU_d2exp_buffered (nv, exponent) |
234
|
|
|
|
|
|
|
SV * nv |
235
|
|
|
|
|
|
|
SV * exponent |
236
|
|
|
|
|
|
|
CODE: |
237
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2exp_buffered (aTHX_ nv, exponent); |
238
|
|
|
|
|
|
|
OUTPUT: RETVAL |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
SV * |
241
|
|
|
|
|
|
|
M_RYU_d2exp (nv, exponent) |
242
|
|
|
|
|
|
|
SV * nv |
243
|
|
|
|
|
|
|
SV * exponent |
244
|
|
|
|
|
|
|
CODE: |
245
|
21
|
|
|
|
|
|
RETVAL = M_RYU_d2exp (aTHX_ nv, exponent); |
246
|
|
|
|
|
|
|
OUTPUT: RETVAL |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
int |
249
|
|
|
|
|
|
|
_sis_perl_version () |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
int |
253
|
|
|
|
|
|
|
M_RYU__has_uint128 () |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
|