On 08/12/2010 04:38 PM, Wei Yongjun wrote:
> Introduce function write_register_operand() to write back the
> register operand.
>
>
>  
> +static void write_register_operand(struct operand *op, unsigned long val,
> +                                unsigned int bytes)
> +{
> +     /* The 4-byte case *is* correct: in 64-bit mode we zero-extend. */
> +     switch (bytes) {
> +     case 1:
> +             *(u8 *)op->addr.reg = (u8)val;
> +             break;
> +     case 2:
> +             *(u16 *)op->addr.reg = (u16)val;
> +             break;
> +     case 4:
> +             *op->addr.reg = (u32)val;
> +             break;  /* 64b: zero-extend */
> +     case 8:
> +             *op->addr.reg = val;
> +             break;
> +     }
> +}

It's cleaner to take val and bytes from struct operand, and do the
assignment from the callers, no?

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to