[RFC] Define/use pad() and pad_mask() instead of open coding it

Mark Marshall mark.marshall at csr.com
Fri Mar 12 02:06:22 PST 2010

Matt Turner wrote:
> I've found some more too--((x + bytes - 1) / bytes) * bytes. Ugh, how nasty.

These two are only equivalent under certain circumstances:

(x + bytes - 1) & ~(bytes - 1)
((x + bytes - 1) / bytes) * bytes

For these to be equivalent bytes must be a power of two.  I haven't 
looked through the files that you are changing, but is this the case?
(Also, I guess x and bytes should be unsigned).


More information about the xorg-devel mailing list