diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-04 11:13:51 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-04 11:13:51 +0000 |
commit | ecf5b771230ef747773aa54960ebc2a46902a0ed (patch) | |
tree | 904c8ff0678ca81906bb871aa9375954cc2c338c /py/compile.c | |
parent | 6902eeda259a5ed8fe3a5ce5cb19ba9207549d33 (diff) |
py: This time, real proper overflow checking of small int power.
Previous overflow test was inadequate.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/compile.c b/py/compile.c index 3273abe40..44b37b934 100644 --- a/py/compile.c +++ b/py/compile.c @@ -17,7 +17,7 @@ #include "obj.h" #include "compile.h" #include "runtime.h" -#include "intdivmod.h" +#include "smallint.h" // TODO need to mangle __attr names @@ -143,10 +143,10 @@ mp_parse_node_t fold_constants(mp_parse_node_t pn) { } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_SLASH)) { ; // pass } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_PERCENT)) { - pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, python_modulo(arg0, arg1)); + pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, mp_small_int_modulo(arg0, arg1)); } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_DBL_SLASH)) { if (arg1 != 0) { - pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, python_floor_divide(arg0, arg1)); + pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, mp_small_int_floor_divide(arg0, arg1)); } } else { // shouldn't happen |