Greg Ungerer | 9863a0b | 2009-03-16 17:54:49 +1000 | [diff] [blame] | 1 | #ifndef _M68K_SWAB_H |
| 2 | #define _M68K_SWAB_H |
| 3 | |
Jaswinder Singh Rajput | 4f308e3 | 2009-06-10 18:47:47 +0530 | [diff] [blame] | 4 | #include <linux/types.h> |
Greg Ungerer | 9863a0b | 2009-03-16 17:54:49 +1000 | [diff] [blame] | 5 | #include <linux/compiler.h> |
| 6 | |
| 7 | #define __SWAB_64_THRU_32__ |
| 8 | |
| 9 | #if defined (__mcfisaaplus__) || defined (__mcfisac__) |
| 10 | static inline __attribute_const__ __u32 __arch_swab32(__u32 val) |
| 11 | { |
| 12 | __asm__("byterev %0" : "=d" (val) : "0" (val)); |
| 13 | return val; |
| 14 | } |
| 15 | |
| 16 | #define __arch_swab32 __arch_swab32 |
Maxim Kuvyrkov | 1454526 | 2009-10-02 12:32:18 +0400 | [diff] [blame] | 17 | #elif !defined(__mcoldfire__) |
Greg Ungerer | 9863a0b | 2009-03-16 17:54:49 +1000 | [diff] [blame] | 18 | |
| 19 | static inline __attribute_const__ __u32 __arch_swab32(__u32 val) |
| 20 | { |
| 21 | __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); |
| 22 | return val; |
| 23 | } |
| 24 | #define __arch_swab32 __arch_swab32 |
Harvey Harrison | 6aeea60 | 2009-01-20 17:50:51 -0800 | [diff] [blame] | 25 | #endif |
Greg Ungerer | 9863a0b | 2009-03-16 17:54:49 +1000 | [diff] [blame] | 26 | |
| 27 | #endif /* _M68K_SWAB_H */ |