On 04/29/2014 03:38 AM, Alex Bennée wrote: >> next: >> > - if (search_pc >= 0 && search_pc < s->code_ptr - gen_code_buf) { >> > + if (search_pc >= 0 >> > + && search_pc < (intptr_t)s->code_ptr - >> > (intptr_t)gen_code_buf) { >> > return op_index; >> > } > I thought we were trying to avoid excessive casting with pointer > arithmetic? Can this be made neater? >
Replaced thus: diff --git a/tcg/tcg.c b/tcg/tcg.c index a835632..0b0be45 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2683,8 +2683,7 @@ static inline int tcg_gen_code_common(TCGContext *s, } args += def->nb_args; next: - if (search_pc >= 0 - && search_pc < (intptr_t)s->code_ptr - (intptr_t)gen_code_buf) { + if (search_pc >= 0 && search_pc < tcg_current_code_size(s)) { return op_index; } op_index++; r~