mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
include: misc.h: unexport various bit/byte counting inline functions
Those aren't used by any external drivers, so no need to keep them in public header. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -156,53 +156,6 @@ typedef int XRetCode;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calculate the number of bytes needed to hold bits.
|
||||
* @param bits The minimum number of bits needed.
|
||||
* @return The number of bytes needed to hold bits.
|
||||
*/
|
||||
static inline int
|
||||
bits_to_bytes(const int bits)
|
||||
{
|
||||
return ((bits + 7) >> 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of 4-byte units needed to hold the given number of
|
||||
* bytes.
|
||||
* @param bytes The minimum number of bytes needed.
|
||||
* @return The number of 4-byte units needed to hold bytes.
|
||||
*/
|
||||
static inline CARD32
|
||||
bytes_to_int32(const size_t bytes)
|
||||
{
|
||||
return (CARD32)(((bytes) + 3) >> 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of bytes (in multiples of 4) needed to hold bytes.
|
||||
* @param bytes The minimum number of bytes needed.
|
||||
* @return The closest multiple of 4 that is equal or higher than bytes.
|
||||
*/
|
||||
static inline int
|
||||
pad_to_int32(const int bytes)
|
||||
{
|
||||
return (((bytes) + 3) & ~3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate padding needed to bring the number of bytes to an even
|
||||
* multiple of 4.
|
||||
* @param bytes The minimum number of bytes needed.
|
||||
* @return The bytes of padding needed to arrive at the closest multiple of 4
|
||||
* that is equal or higher than bytes.
|
||||
*/
|
||||
static inline int
|
||||
padding_for_int32(const int bytes)
|
||||
{
|
||||
return ((-bytes) & 3);
|
||||
}
|
||||
|
||||
/* some macros to help swap requests, replies, and events */
|
||||
|
||||
#define LengthRestS(stuff) \
|
||||
|
||||
Reference in New Issue
Block a user