summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/bfin/bits/byteswap.h
diff options
context:
space:
mode:
authorBernd Schmidt <bernds_cb1@t-online.de>2007-11-23 17:14:20 +0000
committerBernd Schmidt <bernds_cb1@t-online.de>2007-11-23 17:14:20 +0000
commitb3ace38d1f7a2a9e71067af284a3ff38cfe26a35 (patch)
treea5d157e6a116b232c622aa4d1763fedf68ea1174 /libc/sysdeps/linux/bfin/bits/byteswap.h
parente17b3fdaff742b9a9145d1184fd10819f1af5f79 (diff)
From Jie Zhang:
__bswap_16 could not assume that it's zero extended when an unsigned short int is loaded into the data register.
Diffstat (limited to 'libc/sysdeps/linux/bfin/bits/byteswap.h')
-rw-r--r--libc/sysdeps/linux/bfin/bits/byteswap.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/bfin/bits/byteswap.h b/libc/sysdeps/linux/bfin/bits/byteswap.h
index de6862236..74b87d94c 100644
--- a/libc/sysdeps/linux/bfin/bits/byteswap.h
+++ b/libc/sysdeps/linux/bfin/bits/byteswap.h
@@ -25,9 +25,10 @@
if (__builtin_constant_p (__x)) \
__v = __bswap_constant_16 (__x); \
else \
- __asm__ ("%0 <<= 8;" \
- "%1.L = %0.L + %0.H (NS);" \
- : "+d" (__x), "=d" (__v)); \
+ __asm__ ("%0 = PACK (%1.L, %1.L);" \
+ "%0 >>= 8;" \
+ : "=d" (__v) \
+ : "d" (__x)); \
__v; }))
#else
static __inline unsigned short int