[PATCH 01/18] include: introduce byte counting functions.
Peter Hutterer
peter.hutterer at who-t.net
Thu Jul 9 02:53:17 PDT 2009
On Thu, Jul 09, 2009 at 11:01:54AM +0200, David Jander wrote:
> On Thursday 09 July 2009 02:04:59 Peter Hutterer wrote:
> > This patch adds the following three functions:
> > num_bytes_for_bits(bits) - the number of bytes needed to hold 'bits'
> > num_dwords_for_bytes(bytes) - the number of 4-byte units to hold 'bytes'
> > pad_to_dwords(bytes) - the closest multiple of 4 equal to or larger than
> > 'bytes'.
>
> Sorry to make this probably useless comment about naming, but while a byte has
> a defined length (8 bits), the meaning of "word" and "dword" in terms of
> length is undefined. By definition "word" in computing means the natural unit
> of data used by a particular computer design. This would be 32 bits on most
> 32-bit computers, and by consequence a "dword" would be 64 bit wide.
> Your definition of the names "word" and "dword" seem to be 16-bit
> platform-specific... not the most common platform for Xorg!
> Please, let's deprecate this flawed naming convention, and not use it in new
> code... it's confusing and just plain wrong when used on platform-independent
> code!
>
This can be changed with a simple search+replace, I wouldn't mind changing it.
Please suggest a better alternative naming though, the only appropriate
equivalent I can think of is num_4byte_units_for_bytes and similar which
does make the function names a tad long.
Cheers,
Peter
More information about the xorg-devel
mailing list