On 06/05/2011 07:03 PM, Christoffer Dall wrote: > >> + > >> + /* Banked FIQ registers r8-r12 */ > >> + if (reg_num>= 8&& reg_num<= 12) { > >> + if (mode == MODE_FIQ) { > >> + reg_idx = reg_num - 8; /* 0=r8, ..., 4=r12 */ > >> + return&(regs->fiq_regs[reg_idx]); > >> + } else > >> + return&(regs->usr_regs[reg_num]); > >> + } > > > > You could have a static 2D array indexed by mode and register number, > > returning an offsetof() into the vcpu structure. > > You think it's simpler or faster? I don't quite see the incentive. > It's not going to be called a whole lot given the Virt. Extensions. Yes (those are mostly unpredictable branches), and clearer as well. But I agree it's a rare-enough path that doesn't need optimizing, certainly not prematurely. -- error compiling committee.c: too many arguments to function