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:
Enrico Weigelt, metux IT consult
2025-11-20 12:13:36 +01:00
parent f58fbda10f
commit 5511112ddf
20 changed files with 61 additions and 49 deletions

View File

@@ -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) \