Skip to content

Commit 30b8883

Browse files
committed
[bigint ops] s:g/in PMC/invar PMC/
1 parent e349cb6 commit 30b8883

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/ops/nqp_bigint.ops

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,31 @@ inline op nqp_bigint_setup() :base_core {
133133
P6bigint_initialize);
134134
}
135135

136-
inline op nqp_bigint_add(out PMC, in PMC, in PMC, in PMC) :base_core {
136+
inline op nqp_bigint_add(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
137137
mp_int *a = get_bigint(interp, $2);
138138
mp_int *b = get_bigint(interp, $3);
139139
$1 = REPR($4)->allocate(interp, STABLE($4));
140140
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
141141
mp_add(a, b, get_bigint(interp, $1));
142142
}
143143

144-
inline op nqp_bigint_sub(out PMC, in PMC, in PMC, in PMC) :base_core {
144+
inline op nqp_bigint_sub(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
145145
mp_int *a = get_bigint(interp, $2);
146146
mp_int *b = get_bigint(interp, $3);
147147
$1 = REPR($4)->allocate(interp, STABLE($4));
148148
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
149149
mp_sub(a, b, get_bigint(interp, $1));
150150
}
151151

152-
inline op nqp_bigint_mul(out PMC, in PMC, in PMC, in PMC) :base_core {
152+
inline op nqp_bigint_mul(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
153153
mp_int *a = get_bigint(interp, $2);
154154
mp_int *b = get_bigint(interp, $3);
155155
$1 = REPR($4)->allocate(interp, STABLE($4));
156156
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
157157
mp_mul(a, b, get_bigint(interp, $1));
158158
}
159159

160-
inline op nqp_bigint_div(out PMC, in PMC, in PMC, in PMC) :base_core {
160+
inline op nqp_bigint_div(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
161161
mp_int *a = get_bigint(interp, $2);
162162
mp_int *b = get_bigint(interp, $3);
163163
int result;
@@ -169,15 +169,15 @@ inline op nqp_bigint_div(out PMC, in PMC, in PMC, in PMC) :base_core {
169169
"Divide by zero");
170170
}
171171

172-
inline op nqp_bigint_mod(out PMC, in PMC, in PMC, in PMC) :base_core {
172+
inline op nqp_bigint_mod(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
173173
mp_int *a = get_bigint(interp, $2);
174174
mp_int *b = get_bigint(interp, $3);
175175
$1 = REPR($4)->allocate(interp, STABLE($4));
176176
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
177177
mp_mod(a, b, get_bigint(interp, $1));
178178
}
179179

180-
inline op nqp_bigint_exp_mod(out PMC, in PMC, in PMC, in PMC, in PMC) :base_core {
180+
inline op nqp_bigint_exp_mod(out PMC, invar PMC, invar PMC, invar PMC, invar PMC) :base_core {
181181
mp_int *a = get_bigint(interp, $2);
182182
mp_int *b = get_bigint(interp, $3);
183183
mp_int *c = get_bigint(interp, $4);
@@ -213,89 +213,89 @@ inline op nqp_bigint_rand(out PMC, invar PMC, invar PMC) :base_core {
213213
}
214214

215215

216-
inline op nqp_bigint_neg(out PMC, in PMC, in PMC) :base_core {
216+
inline op nqp_bigint_neg(out PMC, invar PMC, invar PMC) :base_core {
217217
mp_int *a = get_bigint(interp, $2);
218218
$1 = REPR($3)->allocate(interp, STABLE($3));
219219
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
220220
mp_neg(a, get_bigint(interp, $1));
221221
}
222-
inline op nqp_bigint_abs(out PMC, in PMC, in PMC) :base_core {
222+
inline op nqp_bigint_abs(out PMC, invar PMC, invar PMC) :base_core {
223223
mp_int *a = get_bigint(interp, $2);
224224
$1 = REPR($3)->allocate(interp, STABLE($3));
225225
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
226226
mp_abs(a, get_bigint(interp, $1));
227227
}
228228

229-
inline op nqp_bigint_cmp(out INT, in PMC, in PMC) :base_core {
229+
inline op nqp_bigint_cmp(out INT, invar PMC, invar PMC) :base_core {
230230
mp_int *a = get_bigint(interp, $2);
231231
mp_int *b = get_bigint(interp, $3);
232232
$1 = mp_cmp(a, b);
233233
}
234234

235-
inline op nqp_bigint_bool(out INT, in PMC) :base_core {
235+
inline op nqp_bigint_bool(out INT, invar PMC) :base_core {
236236
$1 = !mp_iszero(get_bigint(interp, $2));
237237
}
238238

239-
inline op nqp_bigint_eq(out INT, in PMC, in PMC) :base_core {
239+
inline op nqp_bigint_eq(out INT, invar PMC, invar PMC) :base_core {
240240
mp_int *a = get_bigint(interp, $2);
241241
mp_int *b = get_bigint(interp, $3);
242242
$1 = MP_EQ == mp_cmp(a, b);
243243
}
244244

245-
inline op nqp_bigint_ne(out INT, in PMC, in PMC) :base_core {
245+
inline op nqp_bigint_ne(out INT, invar PMC, invar PMC) :base_core {
246246
mp_int *a = get_bigint(interp, $2);
247247
mp_int *b = get_bigint(interp, $3);
248248
$1 = MP_EQ != mp_cmp(a, b);
249249
}
250250

251-
inline op nqp_bigint_gt(out INT, in PMC, in PMC) :base_cor {
251+
inline op nqp_bigint_gt(out INT, invar PMC, invar PMC) :base_cor {
252252
mp_int *a = get_bigint(interp, $2);
253253
mp_int *b = get_bigint(interp, $3);
254254
$1 = MP_GT == mp_cmp(a, b);
255255
}
256256

257-
inline op nqp_bigint_ge(out INT, in PMC, in PMC) :base_core {
257+
inline op nqp_bigint_ge(out INT, invar PMC, invar PMC) :base_core {
258258
mp_int *a = get_bigint(interp, $2);
259259
mp_int *b = get_bigint(interp, $3);
260260
$1 = MP_LT != mp_cmp(a, b);
261261
}
262262

263-
inline op nqp_bigint_lt(out INT, in PMC, in PMC) :base_core {
263+
inline op nqp_bigint_lt(out INT, invar PMC, invar PMC) :base_core {
264264
mp_int *a = get_bigint(interp, $2);
265265
mp_int *b = get_bigint(interp, $3);
266266
$1 = MP_LT == mp_cmp(a, b);
267267
}
268268

269-
inline op nqp_bigint_le(out INT, in PMC, in PMC) :base_core {
269+
inline op nqp_bigint_le(out INT, invar PMC, invar PMC) :base_core {
270270
mp_int *a = get_bigint(interp, $2);
271271
mp_int *b = get_bigint(interp, $3);
272272
$1 = MP_GT != mp_cmp(a, b);
273273
}
274274

275-
inline op nqp_bigint_gcd(out PMC, in PMC, in PMC, in PMC) :base_core {
275+
inline op nqp_bigint_gcd(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
276276
mp_int *a = get_bigint(interp, $2);
277277
mp_int *b = get_bigint(interp, $3);
278278
$1 = REPR($4)->allocate(interp, STABLE($4));
279279
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
280280
mp_gcd(a, b, get_bigint(interp, $1));
281281
}
282282

283-
inline op nqp_bigint_lcm(out PMC, in PMC, in PMC, in PMC) :base_core {
283+
inline op nqp_bigint_lcm(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
284284
mp_int *a = get_bigint(interp, $2);
285285
mp_int *b = get_bigint(interp, $3);
286286
$1 = REPR($4)->allocate(interp, STABLE($4));
287287
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
288288
mp_lcm(a, b, get_bigint(interp, $1));
289289
}
290290

291-
inline op nqp_bigint_from_str(out PMC, in STR, in PMC) :base_core {
291+
inline op nqp_bigint_from_str(out PMC, in STR, invar PMC) :base_core {
292292
const char *buf = Parrot_str_cstring(interp, $2);
293293
$1 = REPR($3)->allocate(interp, STABLE($3));
294294
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
295295
mp_read_radix(get_bigint(interp, $1), buf, 10);
296296
}
297297

298-
inline op nqp_bigint_to_str(out STR, in PMC) :base_core {
298+
inline op nqp_bigint_to_str(out STR, invar PMC) :base_core {
299299
mp_int *i = get_bigint(interp, $2);
300300
int len;
301301
char *buf;
@@ -307,7 +307,7 @@ inline op nqp_bigint_to_str(out STR, in PMC) :base_core {
307307
mem_sys_free(buf);
308308
}
309309

310-
inline op nqp_bigint_to_str_base(out STR, in PMC, in INT) :base_core {
310+
inline op nqp_bigint_to_str_base(out STR, invar PMC, in INT) :base_core {
311311
mp_int *i = get_bigint(interp, $2);
312312
int len;
313313
char *buf;
@@ -319,18 +319,18 @@ inline op nqp_bigint_to_str_base(out STR, in PMC, in INT) :base_core {
319319
mem_sys_free(buf);
320320
}
321321

322-
inline op nqp_bigint_to_num(out NUM, in PMC) :base_core {
322+
inline op nqp_bigint_to_num(out NUM, invar PMC) :base_core {
323323
mp_int *a = get_bigint(interp, $2);
324324
$1 = mp_get_double(a);
325325
}
326326

327-
inline op nqp_bigint_from_num(out PMC, in NUM, in PMC) :base_core {
327+
inline op nqp_bigint_from_num(out PMC, in NUM, invar PMC) :base_core {
328328
$1 = REPR($3)->allocate(interp, STABLE($3));
329329
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
330330
from_num($2, get_bigint(interp, $1));
331331
}
332332

333-
inline op nqp_bigint_div_num(out NUM, in PMC, in PMC) :base_core {
333+
inline op nqp_bigint_div_num(out NUM, invar PMC, invar PMC) :base_core {
334334
mp_int *a = get_bigint(interp, $2);
335335
mp_int *b = get_bigint(interp, $3);
336336

@@ -349,14 +349,14 @@ inline op nqp_bigint_div_num(out NUM, in PMC, in PMC) :base_core {
349349
}
350350
}
351351

352-
inline op nqp_bigint_shr(out PMC, in PMC, in INT, in PMC) :base_core {
352+
inline op nqp_bigint_shr(out PMC, invar PMC, in INT, invar PMC) :base_core {
353353
mp_int *a = get_bigint(interp, $2);
354354
$1 = REPR($4)->allocate(interp, STABLE($4));
355355
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
356356
mp_div_2d(a, $3, get_bigint(interp, $1), NULL);
357357
}
358358

359-
inline op nqp_bigint_shl(out PMC, in PMC, in INT, in PMC) :base_core {
359+
inline op nqp_bigint_shl(out PMC, invar PMC, in INT, invar PMC) :base_core {
360360
mp_int *b;
361361
mp_int *a = get_bigint(interp, $2);
362362
$1 = REPR($4)->allocate(interp, STABLE($4));
@@ -365,28 +365,28 @@ inline op nqp_bigint_shl(out PMC, in PMC, in INT, in PMC) :base_core {
365365
mp_mul_2d(a, $3, b);
366366
}
367367

368-
inline op nqp_bigint_band(out PMC, in PMC, in PMC, in PMC) :base_core {
368+
inline op nqp_bigint_band(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
369369
mp_int *a = get_bigint(interp, $2);
370370
mp_int *b = get_bigint(interp, $3);
371371
$1 = REPR($4)->allocate(interp, STABLE($4));
372372
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
373373
two_complement_bitop(a, b, get_bigint(interp, $1), mp_and);
374374
}
375-
inline op nqp_bigint_bor(out PMC, in PMC, in PMC, in PMC) :base_core {
375+
inline op nqp_bigint_bor(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
376376
mp_int *a = get_bigint(interp, $2);
377377
mp_int *b = get_bigint(interp, $3);
378378
$1 = REPR($4)->allocate(interp, STABLE($4));
379379
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
380380
two_complement_bitop(a, b, get_bigint(interp, $1), mp_or);
381381
}
382-
inline op nqp_bigint_bxor(out PMC, in PMC, in PMC, in PMC) :base_core {
382+
inline op nqp_bigint_bxor(out PMC, invar PMC, invar PMC, invar PMC) :base_core {
383383
mp_int *a = get_bigint(interp, $2);
384384
mp_int *b = get_bigint(interp, $3);
385385
$1 = REPR($4)->allocate(interp, STABLE($4));
386386
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
387387
two_complement_bitop(a, b, get_bigint(interp, $1), mp_xor);
388388
}
389-
inline op nqp_bigint_bnot(out PMC, in PMC, in PMC) :base_core {
389+
inline op nqp_bigint_bnot(out PMC, invar PMC, invar PMC) :base_core {
390390
mp_int *a = get_bigint(interp, $2);
391391
mp_int *b;
392392
$1 = REPR($3)->allocate(interp, STABLE($3));
@@ -420,7 +420,7 @@ The $5 flags is a bitmask that modifies the parse and/or result:
420420

421421
*/
422422

423-
inline op nqp_bigint_radix(out PMC, in INT, in STR, in INT, in INT, in PMC) :base_core {
423+
inline op nqp_bigint_radix(out PMC, in INT, in STR, in INT, in INT, invar PMC) :base_core {
424424
PMC *out;
425425
INTVAL radix = $2;
426426
STRING *str = $3;
@@ -502,7 +502,7 @@ inline op nqp_bigint_radix(out PMC, in INT, in STR, in INT, in INT, in PMC) :bas
502502
* a float is returned. $4 should contain the type object to box the
503503
* float into, $5 the type object to box the bigint into.
504504
*/
505-
inline op nqp_bigint_pow(out PMC, in PMC, in PMC, in PMC, in PMC) :base_core {
505+
inline op nqp_bigint_pow(out PMC, invar PMC, invar PMC, invar PMC, invar PMC) :base_core {
506506
mp_digit exponent_d = 0;
507507
mp_int *exponent = get_bigint(interp, $3);
508508
mp_int *base = get_bigint(interp, $2);
@@ -559,7 +559,7 @@ inline op nqp_bigint_pow(out PMC, in PMC, in PMC, in PMC, in PMC) :base_core {
559559

560560
/* returns 1 if $2 is too large to fit into an INTVAL without loss of
561561
information */
562-
inline op nqp_bigint_is_big(out INT, in PMC) :base_core {
562+
inline op nqp_bigint_is_big(out INT, invar PMC) :base_core {
563563
mp_int *a = get_bigint(interp, $2);
564564
$1 = a->used > 1;
565565
/* XXX somebody please check that on a 32 bit platform */

0 commit comments

Comments
 (0)