diff options
Diffstat (limited to 'lib/roken/bswap.c')
-rw-r--r-- | lib/roken/bswap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/roken/bswap.c b/lib/roken/bswap.c index 7f8c1c22b1b7..b0c4248da11e 100644 --- a/lib/roken/bswap.c +++ b/lib/roken/bswap.c @@ -34,6 +34,23 @@ #include <config.h> #include "roken.h" +#ifndef HAVE_BSWAP64 + +ROKEN_LIB_FUNCTION uint64_t ROKEN_LIB_CALL +bswap64 (uint64_t val) +{ + return + (val & 0xffULL) << 56 | + (val & 0xff00ULL) << 40 | + (val & 0xff0000ULL) << 24 | + (val & 0xff000000ULL) << 8 | + (val & 0xff00000000ULL) >> 8 | + (val & 0xff0000000000ULL) >> 24 | + (val & 0xff000000000000ULL) >> 40 | + (val & 0xff00000000000000ULL) >> 56 ; +} +#endif + #ifndef HAVE_BSWAP32 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL |