Skip to content

Commit 6426a56

Browse files
committed
nqp_bigint_bool op (checks != 0)
1 parent 39c6bcd commit 6426a56

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/PAST/NQP.pir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ entry to produce the node to be returned.
534534
maphash['isgt_i'] = 'isgt__Iii'
535535
maphash['isge_i'] = 'isge__Iii'
536536

537+
maphash['bool_I'] = 'nqp_bigint_bool__iP'
537538
maphash['cmp_I'] = 'nqp_bigint_cmp__IPP'
538539
maphash['iseq_I'] = 'nqp_bigint_eq__IPP'
539540
maphash['isne_I'] = 'nqp_bigint_ne__IPP'

src/ops/nqp_bigint.ops

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ inline op nqp_bigint_cmp(out INT, in PMC, in PMC) :base_cor {
9999
$1 = mp_cmp(a, b);
100100
}
101101

102+
inline op nqp_bigint_bool(out INT, in PMC) :base_core {
103+
$1 = !mp_is_zero(get_bigint(interp, $2));
104+
}
105+
102106
inline op nqp_bigint_eq(out INT, in PMC, in PMC) :base_cor {
103107
mp_int *a = get_bigint(interp, $2);
104108
mp_int *b = get_bigint(interp, $3);

0 commit comments

Comments
 (0)