Skip to content

Commit

Permalink
[js] Implement nqp::fromI_I
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Nov 3, 2017
1 parent 8700050 commit be6a7a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/js/Operations.nqp
Expand Up @@ -1587,6 +1587,8 @@ class QAST::OperationsJS {

add_simple_op('base_I', $T_STR, [$T_OBJ, $T_INT]);

add_simple_op('fromI_I', $T_OBJ, [$T_OBJ, $T_OBJ]);


add_simple_op('div_In', $T_NUM, [$T_OBJ, $T_OBJ]);
add_simple_op('isle_I', $T_INT, [$T_OBJ, $T_OBJ]);
Expand Down
4 changes: 4 additions & 0 deletions src/vm/js/nqp-runtime/bignum.js
Expand Up @@ -219,6 +219,10 @@ op.tonum_I = function(n) {
return getBI(n).toNumber();
};

op.fromI_I = function(value, type) {
return makeBI(type, getBI(value));
};

op.fromnum_I = function(num, type) {
// node-bignum bug workaround, when a negative number is too big it gets turned into 0
if (num < 0) {
Expand Down

0 comments on commit be6a7a1

Please sign in to comment.