@@ -95,7 +95,7 @@ typedef struct _compiler_t {
9595STATIC void compile_syntax_error (compiler_t * comp , mp_parse_node_t pn , const char * msg ) {
9696 // TODO store the error message to a variable in compiler_t instead of printing it
9797 if (MP_PARSE_NODE_IS_STRUCT (pn )) {
98- printf (" File \"%s\", line " UINT_FMT "\n" , qstr_str (comp -> source_file ), (machine_uint_t )((mp_parse_node_struct_t * )pn )-> source_line );
98+ printf (" File \"%s\", line " UINT_FMT "\n" , qstr_str (comp -> source_file ), (mp_uint_t )((mp_parse_node_struct_t * )pn )-> source_line );
9999 } else {
100100 printf (" File \"%s\"\n" , qstr_str (comp -> source_file ));
101101 }
@@ -158,7 +158,7 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
158158 compile_syntax_error (comp , (mp_parse_node_t )pns , "constant must be an integer" );
159159 break ;
160160 }
161- machine_int_t value = MP_PARSE_NODE_LEAF_SMALL_INT (pn_value );
161+ mp_int_t value = MP_PARSE_NODE_LEAF_SMALL_INT (pn_value );
162162
163163 // store the value in the table of dynamic constants
164164 mp_map_elem_t * elem = mp_map_lookup (consts , MP_OBJ_NEW_QSTR (id_qstr ), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND );
@@ -200,25 +200,25 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
200200 case PN_expr :
201201 if (n == 2 && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [0 ]) && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [1 ])) {
202202 // int | int
203- machine_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
204- machine_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
203+ mp_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
204+ mp_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
205205 pn = mp_parse_node_new_leaf (MP_PARSE_NODE_SMALL_INT , arg0 | arg1 );
206206 }
207207 break ;
208208
209209 case PN_and_expr :
210210 if (n == 2 && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [0 ]) && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [1 ])) {
211211 // int & int
212- machine_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
213- machine_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
212+ mp_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
213+ mp_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
214214 pn = mp_parse_node_new_leaf (MP_PARSE_NODE_SMALL_INT , arg0 & arg1 );
215215 }
216216 break ;
217217
218218 case PN_shift_expr :
219219 if (n == 3 && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [0 ]) && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [2 ])) {
220- machine_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
221- machine_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
220+ mp_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
221+ mp_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
222222 if (MP_PARSE_NODE_IS_TOKEN_KIND (pns -> nodes [1 ], MP_TOKEN_OP_DBL_LESS )) {
223223 // int << int
224224 if (!(arg1 >= BITS_PER_WORD || arg0 > (MP_SMALL_INT_MAX >> arg1 ) || arg0 < (MP_SMALL_INT_MIN >> arg1 ))) {
@@ -235,10 +235,10 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
235235 break ;
236236
237237 case PN_arith_expr :
238- // overflow checking here relies on SMALL_INT being strictly smaller than machine_int_t
238+ // overflow checking here relies on SMALL_INT being strictly smaller than mp_int_t
239239 if (n == 3 && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [0 ]) && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [2 ])) {
240- machine_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
241- machine_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
240+ mp_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
241+ mp_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
242242 if (MP_PARSE_NODE_IS_TOKEN_KIND (pns -> nodes [1 ], MP_TOKEN_OP_PLUS )) {
243243 // int + int
244244 arg0 += arg1 ;
@@ -258,8 +258,8 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
258258
259259 case PN_term :
260260 if (n == 3 && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [0 ]) && MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [2 ])) {
261- machine_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
262- machine_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
261+ mp_int_t arg0 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [0 ]);
262+ mp_int_t arg1 = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [2 ]);
263263 if (MP_PARSE_NODE_IS_TOKEN_KIND (pns -> nodes [1 ], MP_TOKEN_OP_STAR )) {
264264 // int * int
265265 if (!mp_small_int_mul_overflow (arg0 , arg1 )) {
@@ -288,7 +288,7 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
288288
289289 case PN_factor_2 :
290290 if (MP_PARSE_NODE_IS_SMALL_INT (pns -> nodes [1 ])) {
291- machine_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
291+ mp_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT (pns -> nodes [1 ]);
292292 if (MP_PARSE_NODE_IS_TOKEN_KIND (pns -> nodes [0 ], MP_TOKEN_OP_PLUS )) {
293293 // +int
294294 pn = mp_parse_node_new_leaf (MP_PARSE_NODE_SMALL_INT , arg );
@@ -336,7 +336,7 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m
336336 mp_obj_t dest [2 ];
337337 mp_load_method_maybe (elem -> value , q_attr , dest );
338338 if (MP_OBJ_IS_SMALL_INT (dest [0 ]) && dest [1 ] == NULL ) {
339- machine_int_t val = MP_OBJ_SMALL_INT_VALUE (dest [0 ]);
339+ mp_int_t val = MP_OBJ_SMALL_INT_VALUE (dest [0 ]);
340340 if (MP_SMALL_INT_FITS (val )) {
341341 pn = mp_parse_node_new_leaf (MP_PARSE_NODE_SMALL_INT , val );
342342 }
@@ -482,7 +482,7 @@ STATIC void cpython_c_print_quoted_str(vstr_t *vstr, const char *str, uint len,
482482STATIC void cpython_c_tuple_emit_const (compiler_t * comp , mp_parse_node_t pn , vstr_t * vstr ) {
483483 if (MP_PARSE_NODE_IS_STRUCT_KIND (pn , PN_string )) {
484484 mp_parse_node_struct_t * pns = (mp_parse_node_struct_t * )pn ;
485- cpython_c_print_quoted_str (vstr , (const char * )pns -> nodes [0 ], (machine_uint_t )pns -> nodes [1 ], false);
485+ cpython_c_print_quoted_str (vstr , (const char * )pns -> nodes [0 ], (mp_uint_t )pns -> nodes [1 ], false);
486486 return ;
487487 }
488488
@@ -2528,7 +2528,7 @@ void compile_atom_string(compiler_t *comp, mp_parse_node_struct_t *pns) {
25282528 mp_parse_node_struct_t * pns_string = (mp_parse_node_struct_t * )pns -> nodes [i ];
25292529 assert (MP_PARSE_NODE_STRUCT_KIND (pns_string ) == PN_string );
25302530 pn_kind = MP_PARSE_NODE_STRING ;
2531- n_bytes += (machine_uint_t )pns_string -> nodes [1 ];
2531+ n_bytes += (mp_uint_t )pns_string -> nodes [1 ];
25322532 }
25332533 if (i == 0 ) {
25342534 string_kind = pn_kind ;
@@ -2549,8 +2549,8 @@ void compile_atom_string(compiler_t *comp, mp_parse_node_struct_t *pns) {
25492549 s_dest += s_len ;
25502550 } else {
25512551 mp_parse_node_struct_t * pns_string = (mp_parse_node_struct_t * )pns -> nodes [i ];
2552- memcpy (s_dest , (const char * )pns_string -> nodes [0 ], (machine_uint_t )pns_string -> nodes [1 ]);
2553- s_dest += (machine_uint_t )pns_string -> nodes [1 ];
2552+ memcpy (s_dest , (const char * )pns_string -> nodes [0 ], (mp_uint_t )pns_string -> nodes [1 ]);
2553+ s_dest += (mp_uint_t )pns_string -> nodes [1 ];
25542554 }
25552555 }
25562556 qstr q = qstr_build_end (q_ptr );
@@ -2858,10 +2858,10 @@ void compile_node(compiler_t *comp, mp_parse_node_t pn) {
28582858 if (MP_PARSE_NODE_IS_NULL (pn )) {
28592859 // pass
28602860 } else if (MP_PARSE_NODE_IS_SMALL_INT (pn )) {
2861- machine_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT (pn );
2861+ mp_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT (pn );
28622862 EMIT_ARG (load_const_small_int , arg );
28632863 } else if (MP_PARSE_NODE_IS_LEAF (pn )) {
2864- machine_uint_t arg = MP_PARSE_NODE_LEAF_ARG (pn );
2864+ mp_uint_t arg = MP_PARSE_NODE_LEAF_ARG (pn );
28652865 switch (MP_PARSE_NODE_LEAF_KIND (pn )) {
28662866 case MP_PARSE_NODE_ID : EMIT_ARG (load_id , arg ); break ;
28672867 case MP_PARSE_NODE_INTEGER : EMIT_ARG (load_const_int , arg ); break ;
@@ -2883,7 +2883,7 @@ void compile_node(compiler_t *comp, mp_parse_node_t pn) {
28832883 mp_parse_node_struct_t * pns = (mp_parse_node_struct_t * )pn ;
28842884 EMIT_ARG (set_line_number , pns -> source_line );
28852885 if (MP_PARSE_NODE_STRUCT_KIND (pns ) == PN_string ) {
2886- EMIT_ARG (load_const_str , qstr_from_strn ((const char * )pns -> nodes [0 ], (machine_uint_t )pns -> nodes [1 ]), false);
2886+ EMIT_ARG (load_const_str , qstr_from_strn ((const char * )pns -> nodes [0 ], (mp_uint_t )pns -> nodes [1 ]), false);
28872887 } else {
28882888 compile_function_t f = compile_function [MP_PARSE_NODE_STRUCT_KIND (pns )];
28892889 if (f == NULL ) {
@@ -3337,7 +3337,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
33373337 return ;
33383338 }
33393339 if (pass > MP_PASS_SCOPE ) {
3340- machine_int_t bytesize = MP_PARSE_NODE_LEAF_SMALL_INT (pn_arg [0 ]);
3340+ mp_int_t bytesize = MP_PARSE_NODE_LEAF_SMALL_INT (pn_arg [0 ]);
33413341 for (uint i = 1 ; i < n_args ; i ++ ) {
33423342 if (!MP_PARSE_NODE_IS_SMALL_INT (pn_arg [i ])) {
33433343 compile_syntax_error (comp , nodes [i ], "inline assembler 'data' requires integer arguments" );
0 commit comments