1#ifndef _PARISC_BYTEORDER_H
2#define _PARISC_BYTEORDER_H
3
4#include <asm/types.h>
5
6#ifdef __GNUC__
7
8static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
9{
10 unsigned int temp;
11 __asm__("shd %0, %0, 16, %1\n\t"
12 "dep %1, 15, 8, %1\n\t"
13 "shd %0, %1, 8, %0"
14 : "=r" (x), "=&r" (temp)
15 : "0" (x));
16 return x;
17}
18
19
20#if BITS_PER_LONG > 32
21
22
23
24
25
26
27
28
29
30
31static __inline__ __const__ __u64 ___arch__swab64(__u64 x) {
32 __u64 temp;
33 __asm__("permh 3210, %0, %0\n\t"
34 "hshl %0, 8, %1\n\t"
35 "hshr u, %0, 8, %0\n\t"
36 "or %1, %0, %0"
37 : "=r" (x), "=&r" (temp)
38 : "0" (x));
39 return x;
40}
41#define __arch__swab64(x) ___arch__swab64(x)
42#else
43static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
44{
45 __u32 t1 = (__u32) x;
46 __u32 t2 = (__u32) ((x) >> 32);
47 ___arch__swab32(t1);
48 ___arch__swab32(t2);
49 return (((__u64) t1 << 32) + ((__u64) t2));
50}
51#endif
52
53
54static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
55{
56 __asm__("dep %0, 15, 8, %0\n\t"
57 "shd %r0, %0, 8, %0"
58 : "=r" (x)
59 : "0" (x));
60 return x;
61}
62
63#define __arch__swab32(x) ___arch__swab32(x)
64#define __arch__swab16(x) ___arch__swab16(x)
65
66#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
67# define __BYTEORDER_HAS_U64__
68# define __SWAB_64_THRU_32__
69#endif
70
71#endif
72
73#include <linux/byteorder/big_endian.h>
74
75#endif
76