diff options
author | Matt Turner <mattst88@gmail.com> | 2011-08-16 19:30:20 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2011-09-21 17:14:44 -0400 |
commit | a2f0ff5f73db204a9d61e65148b28f6acc5121df (patch) | |
tree | f4dbbf0331441ae512dc7fc13cc99634b049dd2a | |
parent | e8ff555b95baab66cc7d060c1e7f9fdd49d3802f (diff) |
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>
-rw-r--r-- | include/misc.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/misc.h b/include/misc.h index ac27a81f3..096a31ad0 100644 --- a/include/misc.h +++ b/include/misc.h @@ -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 |