Make lswap{l,s} inline functions
text data bss dec hex filename before: 1875668 52136 78040 2005844 1e9b54 hw/xfree86/Xorg after: 1875588 52136 78040 2005764 1e9b04 hw/xfree86/Xorg Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
e8ff555b95
commit
a2f0ff5f73
|
@ -122,13 +122,19 @@ typedef struct _xReq *xReqPtr;
|
|||
|
||||
|
||||
/* byte swap a 32-bit literal */
|
||||
#define lswapl(x) ((((x) & 0xff) << 24) |\
|
||||
(((x) & 0xff00) << 8) |\
|
||||
(((x) & 0xff0000) >> 8) |\
|
||||
(((x) >> 24) & 0xff))
|
||||
static inline uint32_t lswapl(uint32_t x)
|
||||
{
|
||||
return ((x & 0xff) << 24) |
|
||||
((x & 0xff00) << 8) |
|
||||
((x & 0xff0000) >> 8) |
|
||||
((x >> 24) & 0xff);
|
||||
}
|
||||
|
||||
/* byte swap a short literal */
|
||||
#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
|
||||
/* byte swap a 16-bit literal */
|
||||
static inline uint16_t lswaps(uint16_t x)
|
||||
{
|
||||
return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
|
||||
}
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
|
Loading…
Reference in New Issue
Block a user