[PATCH 01/18] include: introduce byte counting functions.
David Jander
david.jander at protonic.nl
Thu Jul 9 02:01:54 PDT 2009
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!
Best regards,
--
David Jander
Protonic Holland.
More information about the xorg-devel
mailing list