On Wed, Feb 04, 2009 at 02:29:07PM +0200, Avi Kivity wrote: > Gleb Natapov wrote: >> For STS register bit are cleared by writing 1 into it. >> >> +static uint16_t gpe_write_val(uint16_t cur, int addr, uint32_t val) >> +{ >> + if (addr & 1) >> + return (cur & 0xff) | (val << 8); >> + return (cur & 0xff00) | (val & 0xff); >> +} >> + >> +static uint16_t gpe_reset_val(uint16_t cur, int addr, uint32_t val) >> +{ >> + uint16_t x1, x0 = val & 0xff; >> + int shift = (addr & 1) ? 8 : 0; >> + >> + x1 = (cur >> shift) & 0xff; >> + >> + x1 = x1 & ~x0; >> + >> + return (cur & (0xff << (8 - shift))) | (x1 << shift); >> +} >> > > It's strange that write_val() and reset_val() return a value. Won't it > be cleaner to make val a pointer? > >From functional programing POV no, it is not cleaner. But I don't really care where to do assignment. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html