diff options
author | Anton Blanchard <anton@samba.org> | 2013-12-06 08:40:11 +1100 |
---|---|---|
committer | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2013-12-06 16:30:18 +0530 |
commit | dad7598b1b53a3c9cd8a3c20300270d0d621a5f3 (patch) | |
tree | 12bb68214cd36a3a4592cec52963d86e5e1fb03f | |
parent | 2c5bb18a5567799d2b47c1349651ef35509e0196 (diff) | |
download | SLOF-dad7598b1b53a3c9cd8a3c20300270d0d621a5f3.zip SLOF-dad7598b1b53a3c9cd8a3c20300270d0d621a5f3.tar.gz SLOF-dad7598b1b53a3c9cd8a3c20300270d0d621a5f3.tar.bz2 |
Add bswap_{16,32,64}p
Add byte swap macros that take a pointer and byte swap
in place.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
-rw-r--r-- | include/byteorder.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/byteorder.h b/include/byteorder.h index 3ad4dd1..60ca672 100644 --- a/include/byteorder.h +++ b/include/byteorder.h @@ -37,6 +37,24 @@ bswap_64 (uint64_t x) return __builtin_bswap64(x); } +static inline void +bswap_16p (uint16_t *x) +{ + *x = __builtin_bswap16(*x); +} + +static inline void +bswap_32p (uint32_t *x) +{ + *x = __builtin_bswap32(*x); +} + +static inline void +bswap_64p (uint64_t *x) +{ + *x = __builtin_bswap64(*x); +} + /* gcc defines __BIG_ENDIAN__ on big endian targets */ #ifdef __BIG_ENDIAN__ |