summaryrefslogtreecommitdiffstatshomepage
path: root/py/objfloat.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-30 13:35:08 +0100
committerDamien George <damien.p.george@gmail.com>2014-03-30 13:35:08 +0100
commitd17926db710189db97a49e9b2e72d782fc404231 (patch)
tree406396ee6f3010511a606dd4ea3ed5a817d959eb /py/objfloat.c
parent09d207785c77c85c957471b064ceebe0d2ee0a23 (diff)
downloadmicropython-d17926db710189db97a49e9b2e72d782fc404231.tar.gz
micropython-d17926db710189db97a49e9b2e72d782fc404231.zip
Rename rt_* to mp_*.
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
Diffstat (limited to 'py/objfloat.c')
-rw-r--r--py/objfloat.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/py/objfloat.c b/py/objfloat.c
index c4567c4a38..babc0c479b 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -56,9 +56,9 @@ STATIC mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
STATIC mp_obj_t float_unary_op(int op, mp_obj_t o_in) {
mp_obj_float_t *o = o_in;
switch (op) {
- case RT_UNARY_OP_BOOL: return MP_BOOL(o->value != 0);
- case RT_UNARY_OP_POSITIVE: return o_in;
- case RT_UNARY_OP_NEGATIVE: return mp_obj_new_float(-o->value);
+ case MP_UNARY_OP_BOOL: return MP_BOOL(o->value != 0);
+ case MP_UNARY_OP_POSITIVE: return o_in;
+ case MP_UNARY_OP_NEGATIVE: return mp_obj_new_float(-o->value);
default: return NULL; // op not supported
}
}
@@ -97,27 +97,27 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in) {
mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs_in) {
mp_float_t rhs_val = mp_obj_get_float(rhs_in); // can be any type, this function will convert to float (if possible)
switch (op) {
- case RT_BINARY_OP_ADD:
- case RT_BINARY_OP_INPLACE_ADD: lhs_val += rhs_val; break;
- case RT_BINARY_OP_SUBTRACT:
- case RT_BINARY_OP_INPLACE_SUBTRACT: lhs_val -= rhs_val; break;
- case RT_BINARY_OP_MULTIPLY:
- case RT_BINARY_OP_INPLACE_MULTIPLY: lhs_val *= rhs_val; break;
+ case MP_BINARY_OP_ADD:
+ case MP_BINARY_OP_INPLACE_ADD: lhs_val += rhs_val; break;
+ case MP_BINARY_OP_SUBTRACT:
+ case MP_BINARY_OP_INPLACE_SUBTRACT: lhs_val -= rhs_val; break;
+ case MP_BINARY_OP_MULTIPLY:
+ case MP_BINARY_OP_INPLACE_MULTIPLY: lhs_val *= rhs_val; break;
/* TODO floor(?) the value
- case RT_BINARY_OP_FLOOR_DIVIDE:
- case RT_BINARY_OP_INPLACE_FLOOR_DIVIDE: val = lhs_val / rhs_val; break;
+ case MP_BINARY_OP_FLOOR_DIVIDE:
+ case MP_BINARY_OP_INPLACE_FLOOR_DIVIDE: val = lhs_val / rhs_val; break;
*/
- case RT_BINARY_OP_TRUE_DIVIDE:
- case RT_BINARY_OP_INPLACE_TRUE_DIVIDE:
+ case MP_BINARY_OP_TRUE_DIVIDE:
+ case MP_BINARY_OP_INPLACE_TRUE_DIVIDE:
lhs_val /= rhs_val;
if (isinf(lhs_val)){ // check for division by zero
nlr_jump(mp_obj_new_exception_msg(&mp_type_ZeroDivisionError, "float division by zero"));
}
break;
- case RT_BINARY_OP_LESS: return MP_BOOL(lhs_val < rhs_val);
- case RT_BINARY_OP_MORE: return MP_BOOL(lhs_val > rhs_val);
- case RT_BINARY_OP_LESS_EQUAL: return MP_BOOL(lhs_val <= rhs_val);
- case RT_BINARY_OP_MORE_EQUAL: return MP_BOOL(lhs_val >= rhs_val);
+ case MP_BINARY_OP_LESS: return MP_BOOL(lhs_val < rhs_val);
+ case MP_BINARY_OP_MORE: return MP_BOOL(lhs_val > rhs_val);
+ case MP_BINARY_OP_LESS_EQUAL: return MP_BOOL(lhs_val <= rhs_val);
+ case MP_BINARY_OP_MORE_EQUAL: return MP_BOOL(lhs_val >= rhs_val);
return NULL; // op not supported
}