Skip to content

Commit

Permalink
attempt to have fast mp_set and not broken windows
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Jun 1, 2019
1 parent c20f896 commit 4aa256b
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/math/bigintops.c
Expand Up @@ -166,18 +166,31 @@ static mp_int * force_bigint(MVMThreadContext *tc, const MVMP6bigintBody *body,
return body->u.bigint;
}
else {
MVMint64 value = body->u.smallint.value;
mp_int *i = tc->temp_bigints[idx];
if (value >= 0) {
mp_digit d = value;
mp_set(i, d);
if (sizeof(mp_digit) > 4) {
MVMint64 value = body->u.smallint.value;
mp_int *i = tc->temp_bigints[idx];
if (value >= 0) {
mp_digit d = value;
mp_set(i, d);
}
else {
mp_digit d = -value;
mp_set(i, d);
mp_neg(i, i);
}
return i;
}
else {
mp_digit d = -value;
mp_set(i, d);
mp_neg(i, i);
MVMint32 value = body->u.smallint.value;
mp_int *i = tc->temp_bigints[idx];
if (value >= 0) {
mp_set_int(i, value);
}
else {
mp_set_int(i, -value);
}
return i;
}
return i;
}
}

Expand Down

0 comments on commit 4aa256b

Please sign in to comment.