On 04/29/2014 03:38 AM, Alex Bennée wrote: >> @@ -2653,7 +2683,8 @@ static inline int tcg_gen_code_common(TCGContext *s, >> uint8_t *gen_code_buf, >> } >> args += def->nb_args; >> 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?
Yes, incomplete conversion to the helpers. Will fix. >> +#ifndef TCG_TARGET_INSN_UNIT_SIZE >> +#define TCG_TARGET_INSN_UNIT_SIZE 1 >> +#endif >> +#if TCG_TARGET_INSN_UNIT_SIZE == 1 >> +typedef uint8_t tcg_insn_unit; >> +#elif TCG_TARGET_INSN_UNIT_SIZE == 2 >> +typedef uint16_t tcg_insn_unit; >> +#elif TCG_TARGET_INSN_UNIT_SIZE == 4 >> +typedef uint32_t tcg_insn_unit; >> +#elif TCG_TARGET_INSN_UNIT_SIZE == 8 >> +typedef uint64_t tcg_insn_unit; >> +#else >> +/* The port better have done this. */ > > Shouldn't we #error if the port hasn't done this then? The compiler will error very shortly if this hasn't been done, since we'll use the type in a declaration below. But, no, there is no way to #error here. r~