aboutsummaryrefslogtreecommitdiff
path: root/py/objint_longlong.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-01-30 18:49:52 +1100
committerDamien George <damien.p.george@gmail.com>2019-02-12 14:54:51 +1100
commiteee1e8841a852f374b83e0a3e3b0ff7b66e54243 (patch)
treec928ad701fc0df71dc2863178ea8d2e8bea4946b /py/objint_longlong.c
parent019433a17e82f22e8ee24ad1b53156403d4f4a67 (diff)
py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API.
These macros could in principle be (inline) functions so it makes sense to have them lower case, to match the other C API functions. The remaining macros that are upper case are: - MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR - MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE - MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE - MP_OBJ_FUN_MAKE_SIG - MP_DECLARE_CONST_xxx - MP_DEFINE_CONST_xxx These must remain macros because they are used when defining const data (at least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have MP_OBJ_SMALL_INT_VALUE also a macro). For those macros that have been made lower case, compatibility macros are provided for the old names so that users do not need to change their code immediately.
Diffstat (limited to 'py/objint_longlong.c')
-rw-r--r--py/objint_longlong.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index 485803cfc..37e2d6b50 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -58,7 +58,7 @@ mp_obj_t mp_obj_int_from_bytes_impl(bool big_endian, size_t len, const byte *buf
}
void mp_obj_int_to_bytes_impl(mp_obj_t self_in, bool big_endian, size_t len, byte *buf) {
- assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
+ assert(mp_obj_is_type(self_in, &mp_type_int));
mp_obj_int_t *self = self_in;
long long val = self->val;
if (big_endian) {
@@ -77,7 +77,7 @@ void mp_obj_int_to_bytes_impl(mp_obj_t self_in, bool big_endian, size_t len, byt
int mp_obj_int_sign(mp_obj_t self_in) {
mp_longint_impl_t val;
- if (MP_OBJ_IS_SMALL_INT(self_in)) {
+ if (mp_obj_is_small_int(self_in)) {
val = MP_OBJ_SMALL_INT_VALUE(self_in);
} else {
mp_obj_int_t *self = self_in;
@@ -122,16 +122,16 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
long long lhs_val;
long long rhs_val;
- if (MP_OBJ_IS_SMALL_INT(lhs_in)) {
+ if (mp_obj_is_small_int(lhs_in)) {
lhs_val = MP_OBJ_SMALL_INT_VALUE(lhs_in);
} else {
- assert(MP_OBJ_IS_TYPE(lhs_in, &mp_type_int));
+ assert(mp_obj_is_type(lhs_in, &mp_type_int));
lhs_val = ((mp_obj_int_t*)lhs_in)->val;
}
- if (MP_OBJ_IS_SMALL_INT(rhs_in)) {
+ if (mp_obj_is_small_int(rhs_in)) {
rhs_val = MP_OBJ_SMALL_INT_VALUE(rhs_in);
- } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_int)) {
+ } else if (mp_obj_is_type(rhs_in, &mp_type_int)) {
rhs_val = ((mp_obj_int_t*)rhs_in)->val;
} else {
// delegate to generic function to check for extra cases
@@ -266,7 +266,7 @@ mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, uns
}
mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in) {
- if (MP_OBJ_IS_SMALL_INT(self_in)) {
+ if (mp_obj_is_small_int(self_in)) {
return MP_OBJ_SMALL_INT_VALUE(self_in);
} else {
const mp_obj_int_t *self = self_in;
@@ -281,7 +281,7 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
#if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float_impl(mp_obj_t self_in) {
- assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
+ assert(mp_obj_is_type(self_in, &mp_type_int));
mp_obj_int_t *self = self_in;
return self->val;
}