@@ -51,6 +51,33 @@ inline op nqp_bigint_mul(out PMC, in PMC, in PMC) :base_core {
51
51
mp_mul(a, b, get_bigint(interp, $1));
52
52
}
53
53
54
+ inline op nqp_bigint_div(out PMC, in PMC, in PMC) :base_core {
55
+ mp_int *a = get_bigint(interp, $2);
56
+ mp_int *b = get_bigint(interp, $3);
57
+ mp_int *remainder = get_bigint(interp, REPR($2)->instance_of(interp, $2));
58
+ $1 = REPR($2)->instance_of(interp, $2);
59
+ mp_div(a, b, get_bigint(interp, $1), remainder);
60
+ /* XXX do I need to destroy remainder myself? */
61
+ }
62
+
63
+ inline op nqp_bigint_mod(out PMC, in PMC, in PMC) :base_core {
64
+ mp_int *a = get_bigint(interp, $2);
65
+ mp_int *b = get_bigint(interp, $3);
66
+ $1 = REPR($2)->instance_of(interp, $2);
67
+ mp_mod(a, b, get_bigint(interp, $1));
68
+ }
69
+
70
+ inline op nqp_bigint_neg(out PMC, in PMC) :base_core {
71
+ mp_int *a = get_bigint(interp, $2);
72
+ $1 = REPR($2)->instance_of(interp, $2);
73
+ mp_neg(a, get_bigint(interp, $1));
74
+ }
75
+ inline op nqp_bigint_abs(out PMC, in PMC) :base_core {
76
+ mp_int *a = get_bigint(interp, $2);
77
+ $1 = REPR($2)->instance_of(interp, $2);
78
+ mp_abs(a, get_bigint(interp, $1));
79
+ }
80
+
54
81
inline op nqp_bigint_from_str(out PMC, in PMC, in STR) :base_core {
55
82
char *buf = Parrot_str_cstring(interp, $3);
56
83
$1 = REPR($2)->instance_of(interp, $2);
0 commit comments