@@ -137,13 +137,13 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
137
137
(void )kind ;
138
138
mp_obj_uctypes_struct_t * self = MP_OBJ_TO_PTR (self_in );
139
139
const char * typen = "unk" ;
140
- if (MP_OBJ_IS_TYPE (self -> desc , & mp_type_dict )
140
+ if (mp_obj_is_type (self -> desc , & mp_type_dict )
141
141
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
142
- || MP_OBJ_IS_TYPE (self -> desc , & mp_type_ordereddict )
142
+ || mp_obj_is_type (self -> desc , & mp_type_ordereddict )
143
143
#endif
144
144
) {
145
145
typen = "STRUCT" ;
146
- } else if (MP_OBJ_IS_TYPE (self -> desc , & mp_type_tuple )) {
146
+ } else if (mp_obj_is_type (self -> desc , & mp_type_tuple )) {
147
147
mp_obj_tuple_t * t = MP_OBJ_TO_PTR (self -> desc );
148
148
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE (t -> items [0 ]);
149
149
uint agg_type = GET_TYPE (offset , AGG_TYPE_BITS );
@@ -210,14 +210,14 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
210
210
}
211
211
212
212
STATIC mp_uint_t uctypes_struct_size (mp_obj_t desc_in , int layout_type , mp_uint_t * max_field_size ) {
213
- if (!MP_OBJ_IS_TYPE (desc_in , & mp_type_dict )
213
+ if (!mp_obj_is_type (desc_in , & mp_type_dict )
214
214
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
215
- && !MP_OBJ_IS_TYPE (desc_in , & mp_type_ordereddict )
215
+ && !mp_obj_is_type (desc_in , & mp_type_ordereddict )
216
216
#endif
217
217
) {
218
- if (MP_OBJ_IS_TYPE (desc_in , & mp_type_tuple )) {
218
+ if (mp_obj_is_type (desc_in , & mp_type_tuple )) {
219
219
return uctypes_struct_agg_size ((mp_obj_tuple_t * )MP_OBJ_TO_PTR (desc_in ), layout_type , max_field_size );
220
- } else if (MP_OBJ_IS_SMALL_INT (desc_in )) {
220
+ } else if (mp_obj_is_small_int (desc_in )) {
221
221
// We allow sizeof on both type definitions and structures/structure fields,
222
222
// but scalar structure field is lowered into native Python int, so all
223
223
// type info is lost. So, we cannot say if it's scalar type description,
@@ -231,9 +231,9 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
231
231
mp_uint_t total_size = 0 ;
232
232
233
233
for (mp_uint_t i = 0 ; i < d -> map .alloc ; i ++ ) {
234
- if (MP_MAP_SLOT_IS_FILLED (& d -> map , i )) {
234
+ if (mp_map_slot_is_filled (& d -> map , i )) {
235
235
mp_obj_t v = d -> map .table [i ].value ;
236
- if (MP_OBJ_IS_SMALL_INT (v )) {
236
+ if (mp_obj_is_small_int (v )) {
237
237
mp_uint_t offset = MP_OBJ_SMALL_INT_VALUE (v );
238
238
mp_uint_t val_type = GET_TYPE (offset , VAL_TYPE_BITS );
239
239
offset &= VALUE_MASK (VAL_TYPE_BITS );
@@ -248,7 +248,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
248
248
total_size = offset + s ;
249
249
}
250
250
} else {
251
- if (!MP_OBJ_IS_TYPE (v , & mp_type_tuple )) {
251
+ if (!mp_obj_is_type (v , & mp_type_tuple )) {
252
252
syntax_error ();
253
253
}
254
254
mp_obj_tuple_t * t = MP_OBJ_TO_PTR (v );
@@ -272,13 +272,13 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
272
272
STATIC mp_obj_t uctypes_struct_sizeof (size_t n_args , const mp_obj_t * args ) {
273
273
mp_obj_t obj_in = args [0 ];
274
274
mp_uint_t max_field_size = 0 ;
275
- if (MP_OBJ_IS_TYPE (obj_in , & mp_type_bytearray )) {
275
+ if (mp_obj_is_type (obj_in , & mp_type_bytearray )) {
276
276
return mp_obj_len (obj_in );
277
277
}
278
278
int layout_type = LAYOUT_NATIVE ;
279
279
// We can apply sizeof either to structure definition (a dict)
280
280
// or to instantiated structure
281
- if (MP_OBJ_IS_TYPE (obj_in , & uctypes_struct_type )) {
281
+ if (mp_obj_is_type (obj_in , & uctypes_struct_type )) {
282
282
if (n_args != 1 ) {
283
283
mp_raise_TypeError (NULL );
284
284
}
@@ -406,16 +406,16 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
406
406
STATIC mp_obj_t uctypes_struct_attr_op (mp_obj_t self_in , qstr attr , mp_obj_t set_val ) {
407
407
mp_obj_uctypes_struct_t * self = MP_OBJ_TO_PTR (self_in );
408
408
409
- if (!MP_OBJ_IS_TYPE (self -> desc , & mp_type_dict )
409
+ if (!mp_obj_is_type (self -> desc , & mp_type_dict )
410
410
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
411
- && !MP_OBJ_IS_TYPE (self -> desc , & mp_type_ordereddict )
411
+ && !mp_obj_is_type (self -> desc , & mp_type_ordereddict )
412
412
#endif
413
413
) {
414
414
mp_raise_TypeError ("struct: no fields" );
415
415
}
416
416
417
417
mp_obj_t deref = mp_obj_dict_get (self -> desc , MP_OBJ_NEW_QSTR (attr ));
418
- if (MP_OBJ_IS_SMALL_INT (deref )) {
418
+ if (mp_obj_is_small_int (deref )) {
419
419
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE (deref );
420
420
mp_uint_t val_type = GET_TYPE (offset , VAL_TYPE_BITS );
421
421
offset &= VALUE_MASK (VAL_TYPE_BITS );
@@ -476,7 +476,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
476
476
return MP_OBJ_NULL ;
477
477
}
478
478
479
- if (!MP_OBJ_IS_TYPE (deref , & mp_type_tuple )) {
479
+ if (!mp_obj_is_type (deref , & mp_type_tuple )) {
480
480
syntax_error ();
481
481
}
482
482
@@ -543,7 +543,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
543
543
return MP_OBJ_NULL ; // op not supported
544
544
} else {
545
545
// load / store
546
- if (!MP_OBJ_IS_TYPE (self -> desc , & mp_type_tuple )) {
546
+ if (!mp_obj_is_type (self -> desc , & mp_type_tuple )) {
547
547
mp_raise_TypeError ("struct: cannot index" );
548
548
}
549
549
@@ -594,7 +594,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
594
594
595
595
} else if (agg_type == PTR ) {
596
596
byte * p = * (void * * )self -> addr ;
597
- if (MP_OBJ_IS_SMALL_INT (t -> items [1 ])) {
597
+ if (mp_obj_is_small_int (t -> items [1 ])) {
598
598
uint val_type = GET_TYPE (MP_OBJ_SMALL_INT_VALUE (t -> items [1 ]), VAL_TYPE_BITS );
599
599
return get_aligned (val_type , p , index );
600
600
} else {
@@ -618,7 +618,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
618
618
mp_obj_uctypes_struct_t * self = MP_OBJ_TO_PTR (self_in );
619
619
switch (op ) {
620
620
case MP_UNARY_OP_INT :
621
- if (MP_OBJ_IS_TYPE (self -> desc , & mp_type_tuple )) {
621
+ if (mp_obj_is_type (self -> desc , & mp_type_tuple )) {
622
622
mp_obj_tuple_t * t = MP_OBJ_TO_PTR (self -> desc );
623
623
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE (t -> items [0 ]);
624
624
uint agg_type = GET_TYPE (offset , AGG_TYPE_BITS );
0 commit comments