42
42
#define alignof (type ) offsetof(struct { char c; type t; }, t)
43
43
#endif
44
44
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 ) {
46
46
size_t size = 0 ;
47
47
int align = 1 ;
48
48
switch (struct_type ) {
@@ -113,7 +113,7 @@ size_t mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) {
113
113
return size ;
114
114
}
115
115
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 ) {
117
117
mp_int_t val = 0 ;
118
118
switch (typecode ) {
119
119
case 'b' :
@@ -162,7 +162,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, mp_uint_t index) {
162
162
// The long long type is guaranteed to hold at least 64 bits, and size is at
163
163
// most 8 (for q and Q), so we will always be able to parse the given data
164
164
// 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 ) {
166
166
int delta ;
167
167
if (!big_endian ) {
168
168
delta = -1 ;
@@ -187,12 +187,12 @@ long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, con
187
187
#define is_signed (typecode ) (typecode > 'Z')
188
188
mp_obj_t mp_binary_get_val (char struct_type , char val_type , byte * p_base , byte * * ptr ) {
189
189
byte * p = * ptr ;
190
- mp_uint_t align ;
190
+ size_t align ;
191
191
192
192
size_t size = mp_binary_get_size (struct_type , val_type , & align );
193
193
if (struct_type == '@' ) {
194
194
// 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 );
196
196
#if MP_ENDIANNESS_LITTLE
197
197
struct_type = '<' ;
198
198
#else
@@ -231,7 +231,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte *p_base, byte *
231
231
}
232
232
}
233
233
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 ) {
235
235
if (MP_ENDIANNESS_LITTLE && !big_endian ) {
236
236
memcpy (dest , & val , val_sz );
237
237
} 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
252
252
253
253
void mp_binary_set_val (char struct_type , char val_type , mp_obj_t val_in , byte * p_base , byte * * ptr ) {
254
254
byte * p = * ptr ;
255
- mp_uint_t align ;
255
+ size_t align ;
256
256
257
257
size_t size = mp_binary_get_size (struct_type , val_type , & align );
258
258
if (struct_type == '@' ) {
259
259
// 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 );
261
261
if (MP_ENDIANNESS_LITTLE ) {
262
262
struct_type = '<' ;
263
263
} else {
@@ -315,7 +315,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
315
315
mp_binary_set_int (MIN ((size_t )size , sizeof (val )), struct_type == '>' , p , val );
316
316
}
317
317
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 ) {
319
319
switch (typecode ) {
320
320
#if MICROPY_PY_BUILTINS_FLOAT
321
321
case 'f' :
@@ -342,7 +342,7 @@ void mp_binary_set_val_array(char typecode, void *p, mp_uint_t index, mp_obj_t v
342
342
}
343
343
}
344
344
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 ) {
346
346
switch (typecode ) {
347
347
case 'b' :
348
348
((signed char * )p )[index ] = val ;
0 commit comments