@@ -133,31 +133,31 @@ inline op nqp_bigint_setup() :base_core {
133
133
P6bigint_initialize);
134
134
}
135
135
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 {
137
137
mp_int *a = get_bigint(interp, $2);
138
138
mp_int *b = get_bigint(interp, $3);
139
139
$1 = REPR($4)->allocate(interp, STABLE($4));
140
140
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
141
141
mp_add(a, b, get_bigint(interp, $1));
142
142
}
143
143
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 {
145
145
mp_int *a = get_bigint(interp, $2);
146
146
mp_int *b = get_bigint(interp, $3);
147
147
$1 = REPR($4)->allocate(interp, STABLE($4));
148
148
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
149
149
mp_sub(a, b, get_bigint(interp, $1));
150
150
}
151
151
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 {
153
153
mp_int *a = get_bigint(interp, $2);
154
154
mp_int *b = get_bigint(interp, $3);
155
155
$1 = REPR($4)->allocate(interp, STABLE($4));
156
156
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
157
157
mp_mul(a, b, get_bigint(interp, $1));
158
158
}
159
159
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 {
161
161
mp_int *a = get_bigint(interp, $2);
162
162
mp_int *b = get_bigint(interp, $3);
163
163
int result;
@@ -169,15 +169,15 @@ inline op nqp_bigint_div(out PMC, in PMC, in PMC, in PMC) :base_core {
169
169
"Divide by zero");
170
170
}
171
171
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 {
173
173
mp_int *a = get_bigint(interp, $2);
174
174
mp_int *b = get_bigint(interp, $3);
175
175
$1 = REPR($4)->allocate(interp, STABLE($4));
176
176
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
177
177
mp_mod(a, b, get_bigint(interp, $1));
178
178
}
179
179
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 {
181
181
mp_int *a = get_bigint(interp, $2);
182
182
mp_int *b = get_bigint(interp, $3);
183
183
mp_int *c = get_bigint(interp, $4);
@@ -213,89 +213,89 @@ inline op nqp_bigint_rand(out PMC, invar PMC, invar PMC) :base_core {
213
213
}
214
214
215
215
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 {
217
217
mp_int *a = get_bigint(interp, $2);
218
218
$1 = REPR($3)->allocate(interp, STABLE($3));
219
219
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
220
220
mp_neg(a, get_bigint(interp, $1));
221
221
}
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 {
223
223
mp_int *a = get_bigint(interp, $2);
224
224
$1 = REPR($3)->allocate(interp, STABLE($3));
225
225
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
226
226
mp_abs(a, get_bigint(interp, $1));
227
227
}
228
228
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 {
230
230
mp_int *a = get_bigint(interp, $2);
231
231
mp_int *b = get_bigint(interp, $3);
232
232
$1 = mp_cmp(a, b);
233
233
}
234
234
235
- inline op nqp_bigint_bool(out INT, in PMC) :base_core {
235
+ inline op nqp_bigint_bool(out INT, invar PMC) :base_core {
236
236
$1 = !mp_iszero(get_bigint(interp, $2));
237
237
}
238
238
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 {
240
240
mp_int *a = get_bigint(interp, $2);
241
241
mp_int *b = get_bigint(interp, $3);
242
242
$1 = MP_EQ == mp_cmp(a, b);
243
243
}
244
244
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 {
246
246
mp_int *a = get_bigint(interp, $2);
247
247
mp_int *b = get_bigint(interp, $3);
248
248
$1 = MP_EQ != mp_cmp(a, b);
249
249
}
250
250
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 {
252
252
mp_int *a = get_bigint(interp, $2);
253
253
mp_int *b = get_bigint(interp, $3);
254
254
$1 = MP_GT == mp_cmp(a, b);
255
255
}
256
256
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 {
258
258
mp_int *a = get_bigint(interp, $2);
259
259
mp_int *b = get_bigint(interp, $3);
260
260
$1 = MP_LT != mp_cmp(a, b);
261
261
}
262
262
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 {
264
264
mp_int *a = get_bigint(interp, $2);
265
265
mp_int *b = get_bigint(interp, $3);
266
266
$1 = MP_LT == mp_cmp(a, b);
267
267
}
268
268
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 {
270
270
mp_int *a = get_bigint(interp, $2);
271
271
mp_int *b = get_bigint(interp, $3);
272
272
$1 = MP_GT != mp_cmp(a, b);
273
273
}
274
274
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 {
276
276
mp_int *a = get_bigint(interp, $2);
277
277
mp_int *b = get_bigint(interp, $3);
278
278
$1 = REPR($4)->allocate(interp, STABLE($4));
279
279
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
280
280
mp_gcd(a, b, get_bigint(interp, $1));
281
281
}
282
282
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 {
284
284
mp_int *a = get_bigint(interp, $2);
285
285
mp_int *b = get_bigint(interp, $3);
286
286
$1 = REPR($4)->allocate(interp, STABLE($4));
287
287
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
288
288
mp_lcm(a, b, get_bigint(interp, $1));
289
289
}
290
290
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 {
292
292
const char *buf = Parrot_str_cstring(interp, $2);
293
293
$1 = REPR($3)->allocate(interp, STABLE($3));
294
294
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
295
295
mp_read_radix(get_bigint(interp, $1), buf, 10);
296
296
}
297
297
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 {
299
299
mp_int *i = get_bigint(interp, $2);
300
300
int len;
301
301
char *buf;
@@ -307,7 +307,7 @@ inline op nqp_bigint_to_str(out STR, in PMC) :base_core {
307
307
mem_sys_free(buf);
308
308
}
309
309
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 {
311
311
mp_int *i = get_bigint(interp, $2);
312
312
int len;
313
313
char *buf;
@@ -319,18 +319,18 @@ inline op nqp_bigint_to_str_base(out STR, in PMC, in INT) :base_core {
319
319
mem_sys_free(buf);
320
320
}
321
321
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 {
323
323
mp_int *a = get_bigint(interp, $2);
324
324
$1 = mp_get_double(a);
325
325
}
326
326
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 {
328
328
$1 = REPR($3)->allocate(interp, STABLE($3));
329
329
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
330
330
from_num($2, get_bigint(interp, $1));
331
331
}
332
332
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 {
334
334
mp_int *a = get_bigint(interp, $2);
335
335
mp_int *b = get_bigint(interp, $3);
336
336
@@ -349,14 +349,14 @@ inline op nqp_bigint_div_num(out NUM, in PMC, in PMC) :base_core {
349
349
}
350
350
}
351
351
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 {
353
353
mp_int *a = get_bigint(interp, $2);
354
354
$1 = REPR($4)->allocate(interp, STABLE($4));
355
355
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
356
356
mp_div_2d(a, $3, get_bigint(interp, $1), NULL);
357
357
}
358
358
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 {
360
360
mp_int *b;
361
361
mp_int *a = get_bigint(interp, $2);
362
362
$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 {
365
365
mp_mul_2d(a, $3, b);
366
366
}
367
367
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 {
369
369
mp_int *a = get_bigint(interp, $2);
370
370
mp_int *b = get_bigint(interp, $3);
371
371
$1 = REPR($4)->allocate(interp, STABLE($4));
372
372
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
373
373
two_complement_bitop(a, b, get_bigint(interp, $1), mp_and);
374
374
}
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 {
376
376
mp_int *a = get_bigint(interp, $2);
377
377
mp_int *b = get_bigint(interp, $3);
378
378
$1 = REPR($4)->allocate(interp, STABLE($4));
379
379
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
380
380
two_complement_bitop(a, b, get_bigint(interp, $1), mp_or);
381
381
}
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 {
383
383
mp_int *a = get_bigint(interp, $2);
384
384
mp_int *b = get_bigint(interp, $3);
385
385
$1 = REPR($4)->allocate(interp, STABLE($4));
386
386
REPR($1)->initialize(interp, STABLE($1), OBJECT_BODY($1));
387
387
two_complement_bitop(a, b, get_bigint(interp, $1), mp_xor);
388
388
}
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 {
390
390
mp_int *a = get_bigint(interp, $2);
391
391
mp_int *b;
392
392
$1 = REPR($3)->allocate(interp, STABLE($3));
@@ -420,7 +420,7 @@ The $5 flags is a bitmask that modifies the parse and/or result:
420
420
421
421
*/
422
422
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 {
424
424
PMC *out;
425
425
INTVAL radix = $2;
426
426
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
502
502
* a float is returned. $4 should contain the type object to box the
503
503
* float into, $5 the type object to box the bigint into.
504
504
*/
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 {
506
506
mp_digit exponent_d = 0;
507
507
mp_int *exponent = get_bigint(interp, $3);
508
508
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 {
559
559
560
560
/* returns 1 if $2 is too large to fit into an INTVAL without loss of
561
561
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 {
563
563
mp_int *a = get_bigint(interp, $2);
564
564
$1 = a->used > 1;
565
565
/* XXX somebody please check that on a 32 bit platform */
0 commit comments