py: Make mp_binary_set_val work on big endian machine.

This commit is contained in:
Damien George
2014-10-06 15:05:35 +00:00
parent fcdb239815
commit 9336ee320a
4 changed files with 33 additions and 35 deletions

View File

@@ -160,7 +160,7 @@ STATIC mp_obj_t struct_unpack(mp_obj_t fmt_in, mp_obj_t data_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(struct_unpack_obj, struct_unpack);
STATIC mp_obj_t struct_pack(uint n_args, mp_obj_t *args) {
STATIC mp_obj_t struct_pack(mp_uint_t n_args, const mp_obj_t *args) {
// TODO: "The arguments must match the values required by the format exactly."
const char *fmt = mp_obj_str_get_str(args[0]);
char fmt_type = get_fmt_type(&fmt);
@@ -169,7 +169,7 @@ STATIC mp_obj_t struct_pack(uint n_args, mp_obj_t *args) {
mp_obj_t res = mp_obj_str_builder_start(&mp_type_bytes, size, &p);
memset(p, 0, size);
for (uint i = 1; i < n_args; i++) {
for (mp_uint_t i = 1; i < n_args; i++) {
mp_uint_t sz = 1;
if (unichar_isdigit(*fmt)) {
sz = get_fmt_num(&fmt);