Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128000
b: refs/heads/master
c: d2e6675
h: refs/heads/master
v: v3
  • Loading branch information
Harvey Harrison authored and Kyle McMartin committed Jan 5, 2009
1 parent c3235cf commit d68f61a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: df8e5bc6b7b61c8b2aeaf58b6afd762d20a651dd
refs/heads/master: d2e6675fffe435989e51c084600581ca58048c13
37 changes: 12 additions & 25 deletions trunk/arch/parisc/include/asm/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
#include <asm/types.h>
#include <linux/compiler.h>

#ifdef __GNUC__
#define __BIG_ENDIAN
#define __SWAB_64_THRU_32__

static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
{
__asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */
"shd %%r0, %0, 8, %0" /* shift 000000ab -> 00ba */
: "=r" (x)
: "0" (x));
return x;
}
#define __arch_swab16 __arch_swab16

static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
static inline __attribute_const__ __u32 __arch_swab24(__u32 x)
{
__asm__("shd %0, %0, 8, %0\n\t" /* shift xabcxabc -> cxab */
"dep %0, 15, 8, %0\n\t" /* deposit cxab -> cbab */
Expand All @@ -25,7 +27,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
return x;
}

static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
{
unsigned int temp;
__asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */
Expand All @@ -35,7 +37,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
: "0" (x));
return x;
}

#define __arch_swab32 __arch_swab32

#if BITS_PER_LONG > 32
/*
Expand All @@ -48,7 +50,8 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
** HSHR 67452301 -> *6*4*2*0 into %0
** OR %0 | %1 -> 76543210 into %0 (all done!)
*/
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {
static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
{
__u64 temp;
__asm__("permh,3210 %0, %0\n\t"
"hshl %0, 8, %1\n\t"
Expand All @@ -58,25 +61,9 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {
: "0" (x));
return x;
}
#define __arch__swab64(x) ___arch__swab64(x)
#define __BYTEORDER_HAS_U64__
#elif !defined(__STRICT_ANSI__)
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
{
__u32 t1 = ___arch__swab32((__u32) x);
__u32 t2 = ___arch__swab32((__u32) (x >> 32));
return (((__u64) t1 << 32) | t2);
}
#define __arch__swab64(x) ___arch__swab64(x)
#define __BYTEORDER_HAS_U64__
#endif

#define __arch__swab16(x) ___arch__swab16(x)
#define __arch__swab24(x) ___arch__swab24(x)
#define __arch__swab32(x) ___arch__swab32(x)

#endif /* __GNUC__ */
#define __arch_swab64 __arch_swab64
#endif /* BITS_PER_LONG > 32 */

#include <linux/byteorder/big_endian.h>
#include <linux/byteorder.h>

#endif /* _PARISC_BYTEORDER_H */

0 comments on commit d68f61a

Please sign in to comment.