swab.h 665 B

12345678910111213141516171819202122232425262728
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _M68K_SWAB_H
  3. #define _M68K_SWAB_H
  4. #include <linux/types.h>
  5. #include <linux/compiler.h>
  6. #define __SWAB_64_THRU_32__
  7. #if defined (__mcfisaaplus__) || defined (__mcfisac__)
  8. static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
  9. {
  10. __asm__("byterev %0" : "=d" (val) : "0" (val));
  11. return val;
  12. }
  13. #define __arch_swab32 __arch_swab32
  14. #elif !defined(__mcoldfire__)
  15. static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
  16. {
  17. __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
  18. return val;
  19. }
  20. #define __arch_swab32 __arch_swab32
  21. #endif
  22. #endif /* _M68K_SWAB_H */