4242#define alignof (type ) offsetof(struct { char c; type t; }, t)
4343#endif
4444
45- size_t mp_binary_get_size (char struct_type , char val_type , mp_uint_t * palign ) {
45+ size_t mp_binary_get_size (char struct_type , char val_type , size_t * palign ) {
4646 size_t size = 0 ;
4747 int align = 1 ;
4848 switch (struct_type ) {
@@ -113,7 +113,7 @@ size_t mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) {
113113 return size ;
114114}
115115
116- mp_obj_t mp_binary_get_val_array (char typecode , void * p , mp_uint_t index ) {
116+ mp_obj_t mp_binary_get_val_array (char typecode , void * p , size_t index ) {
117117 mp_int_t val = 0 ;
118118 switch (typecode ) {
119119 case 'b' :
@@ -162,7 +162,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, mp_uint_t index) {
162162// The long long type is guaranteed to hold at least 64 bits, and size is at
163163// most 8 (for q and Q), so we will always be able to parse the given data
164164// and fit it into a long long.
165- long long mp_binary_get_int (mp_uint_t size , bool is_signed , bool big_endian , const byte * src ) {
165+ long long mp_binary_get_int (size_t size , bool is_signed , bool big_endian , const byte * src ) {
166166 int delta ;
167167 if (!big_endian ) {
168168 delta = -1 ;
@@ -187,12 +187,12 @@ long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, con
187187#define is_signed (typecode ) (typecode > 'Z')
188188mp_obj_t mp_binary_get_val (char struct_type , char val_type , byte * p_base , byte * * ptr ) {
189189 byte * p = * ptr ;
190- mp_uint_t align ;
190+ size_t align ;
191191
192192 size_t size = mp_binary_get_size (struct_type , val_type , & align );
193193 if (struct_type == '@' ) {
194194 // Align p relative to p_base
195- p = p_base + (uintptr_t )MP_ALIGN (p - p_base , ( size_t ) align );
195+ p = p_base + (uintptr_t )MP_ALIGN (p - p_base , align );
196196 #if MP_ENDIANNESS_LITTLE
197197 struct_type = '<' ;
198198 #else
@@ -231,7 +231,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte *p_base, byte *
231231 }
232232}
233233
234- void mp_binary_set_int (mp_uint_t val_sz , bool big_endian , byte * dest , mp_uint_t val ) {
234+ void mp_binary_set_int (size_t val_sz , bool big_endian , byte * dest , mp_uint_t val ) {
235235 if (MP_ENDIANNESS_LITTLE && !big_endian ) {
236236 memcpy (dest , & val , val_sz );
237237 } else if (MP_ENDIANNESS_BIG && big_endian ) {
@@ -252,12 +252,12 @@ void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *dest, mp_uint_t
252252
253253void mp_binary_set_val (char struct_type , char val_type , mp_obj_t val_in , byte * p_base , byte * * ptr ) {
254254 byte * p = * ptr ;
255- mp_uint_t align ;
255+ size_t align ;
256256
257257 size_t size = mp_binary_get_size (struct_type , val_type , & align );
258258 if (struct_type == '@' ) {
259259 // Align p relative to p_base
260- p = p_base + (uintptr_t )MP_ALIGN (p - p_base , ( size_t ) align );
260+ p = p_base + (uintptr_t )MP_ALIGN (p - p_base , align );
261261 if (MP_ENDIANNESS_LITTLE ) {
262262 struct_type = '<' ;
263263 } else {
@@ -315,7 +315,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
315315 mp_binary_set_int (MIN ((size_t )size , sizeof (val )), struct_type == '>' , p , val );
316316}
317317
318- void mp_binary_set_val_array (char typecode , void * p , mp_uint_t index , mp_obj_t val_in ) {
318+ void mp_binary_set_val_array (char typecode , void * p , size_t index , mp_obj_t val_in ) {
319319 switch (typecode ) {
320320#if MICROPY_PY_BUILTINS_FLOAT
321321 case 'f' :
@@ -342,7 +342,7 @@ void mp_binary_set_val_array(char typecode, void *p, mp_uint_t index, mp_obj_t v
342342 }
343343}
344344
345- void mp_binary_set_val_array_from_int (char typecode , void * p , mp_uint_t index , mp_int_t val ) {
345+ void mp_binary_set_val_array_from_int (char typecode , void * p , size_t index , mp_int_t val ) {
346346 switch (typecode ) {
347347 case 'b' :
348348 ((signed char * )p )[index ] = val ;
0 commit comments