[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] linux/x86: convert 'cpu' (and a few other)variables to unsigned



Jan Beulich writes ("Re: [Xen-devel] [PATCH] linux/x86: convert 'cpu' (and a 
few other)variables to unsigned"):
> When signed int is used as array index or in pointer arithmetic, the
> compiler has to insert an explicit, unconditional sign extension
> operation, whereas in many cases zero extension is implicit by
> preceding operations or can be done with a 32-bit move (which
> doesn't require a REX prefix and thus results in [statisitically] 
> half a byte shorter instructions).

Oh dear.  That really is very unfortunate.

> >Normally it's IMO best practice to avoid `unsigned' other than for
> >bitfields, clock arithmetic, and the like, because the behaviour of
> >unsigned in the presence of subtraction and comparision is often
> >surprising.
> 
> I would disagree here, but it's certainly a personal thing what's
> considered surprising.

Indeed.

> Regardless of this personal aspect, the x86 Linux maintainers are
> actively doing the same thing (or are respectively asking for it to
> be done).

I suppose so.

I'm just not looking forward to all of the bugs of the form
    if (cpus-1 < some_number_of_cpus) ...
and the like.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.