diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-14 18:27:14 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-14 18:27:14 +1100 |
commit | e98ff40604170eb231225a4285d9ef740b8b9501 (patch) | |
tree | 97bc09f44fab2077ccb73f41142c30d0736944ac /py/modbuiltins.c | |
parent | 19aee9438a7a8cf8539536dab5147aedb6b16bb3 (diff) |
py/modbuiltins: Simplify casts from char to byte ptr in builtin ord.
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r-- | py/modbuiltins.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 6b8886804..5461816af 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -343,19 +343,19 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_oct_obj, mp_builtin_oct); STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { size_t len; - const char *str = mp_obj_str_get_data(o_in, &len); + const byte *str = (const byte*)mp_obj_str_get_data(o_in, &len); #if MICROPY_PY_BUILTINS_STR_UNICODE if (MP_OBJ_IS_STR(o_in)) { - len = utf8_charlen((const byte*)str, len); + len = utf8_charlen(str, len); if (len == 1) { - return mp_obj_new_int(utf8_get_char((const byte*)str)); + return mp_obj_new_int(utf8_get_char(str)); } } else #endif { // a bytes object, or a str without unicode support (don't sign extend the char) if (len == 1) { - return MP_OBJ_NEW_SMALL_INT(((const byte*)str)[0]); + return MP_OBJ_NEW_SMALL_INT(str[0]); } } |