byteorder.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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