From: Jeremy S. <js...@mv...> - 2001-12-20 17:49:21
|
NIIBE Yutaka wrote: > I have a comment on the expressions calculating PC. It's OK, but > it would be good if we can improve the implementation. > > > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; > [...] > > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; > [...] > > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; > [...] > > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; > > We want something like "ext.b" or "ext.w" (of SuperH assembler) here. > In general, it's not good practice using type coercion to do the > calculation. Not sure I understand... would you prefer explicit asm statements rather than forcing the ext type using casts? --Jeremy |