Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make nqp::isbig_I consistent with set_int and get_int
turns out that set_int and get_int only support 32bit, even on 64bit
platforms. While the better fix would be to make them work on 64 bit width,
this approach change nqp::isbig_i to return 1 if the stored int takes more
than 32bit.
  • Loading branch information
moritz committed Nov 13, 2011
1 parent bd5e5b0 commit 506177f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ops/nqp_bigint.ops
Expand Up @@ -410,6 +410,11 @@ inline op nqp_bigint_pow(out PMC, in PMC, in PMC, in PMC) :base_core {
/* returns 1 if $2 is too large to fit into an INTVAL without loss of
information */
inline op nqp_bigint_is_big(out INT, in PMC) :base_core {
mp_int *a = get_bigint(interp, $2);
mp_int *a = get_bigint(interp, $2);
$1 = a->used > 1;
if ($1 == 0) {
/* mp_{set,get}_int is limited to 32 bit, so be extra careful. */
if (DIGIT(a, 0) & (~0xFFFFFFFFUL))
$1 = 1;
}
}

0 comments on commit 506177f

Please sign in to comment.