swab.h 633 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef _CRIS_ARCH_SWAB_H
  2. #define _CRIS_ARCH_SWAB_H
  3. #include <asm/types.h>
  4. #include <linux/compiler.h>
  5. #define __SWAB_64_THRU_32__
  6. /* we just define these two (as we can do the swap in a single
  7. * asm instruction in CRIS) and the arch-independent files will put
  8. * them together into ntohl etc.
  9. */
  10. static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
  11. {
  12. __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
  13. return(x);
  14. }
  15. #define __arch_swab32 __arch_swab32
  16. static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
  17. {
  18. __asm__ ("swapb %0" : "=r" (x) : "0" (x));
  19. return(x);
  20. }
  21. #define __arch_swab16 __arch_swab16
  22. #endif