byteorder_64.h 726 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _X86_64_BYTEORDER_H
  2. #define _X86_64_BYTEORDER_H
  3. #include <asm/types.h>
  4. #include <linux/compiler.h>
  5. #ifdef __GNUC__
  6. static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
  7. {
  8. __asm__("bswapq %0" : "=r" (x) : "0" (x));
  9. return x;
  10. }
  11. static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
  12. {
  13. __asm__("bswapl %0" : "=r" (x) : "0" (x));
  14. return x;
  15. }
  16. /* Do not define swab16. Gcc is smart enough to recognize "C" version and
  17. convert it into rotation or exhange. */
  18. #define __arch__swab32(x) ___arch__swab32(x)
  19. #define __arch__swab64(x) ___arch__swab64(x)
  20. #endif /* __GNUC__ */
  21. #define __BYTEORDER_HAS_U64__
  22. #include <linux/byteorder/little_endian.h>
  23. #endif /* _X86_64_BYTEORDER_H */