On Thursday 09 July 2009 11:55:11 René Rebe wrote: > Peter Hutterer wrote: > > 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. > > ...int8..., ...int16..., ...int32..., ...
I agree. Although in theory 'int8' and 'byte' are of the same length (not necessarily same type). If you want to make the names _really_ short, you might consider the convention used in the linux kernel and some other places: u8, s8, u16, s16, u32.... etc, very short and still readable ;-) Thanks! Best regards, -- David Jander Protonic Holland. _______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
