Files
xserver/include
Peter Hutterer 912402fd71 include: introduce byte counting functions.
This patch adds the following three functions:
 bits_to_bytes(bits) - the number of bytes needed to hold 'bits'
 bytes_to_int32(bytes) - the number of 4-byte units to hold 'bytes'
 pad_to_int32(bytes) - the closest multiple of 4 equal to or larger than
                        'bytes'.

All three operations are common in protocol processing and currently the
server has ((foo + 7)/8 + 3)/4 operations all over the place. A common set
of functions reduce the error rate of these (albeit simple) calculations and
improve readability of the code.

The functions do not check for overflow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:05:53 +10:00
..
2008-11-04 16:01:07 +10:30
2009-05-20 16:22:24 +10:00
2009-07-06 12:58:39 +10:00
2009-01-22 15:06:25 +11:00
2009-05-28 17:20:58 +10:00
2008-04-20 08:35:42 -07:00