diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-28 22:30:48 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-28 22:30:48 +0000 |
commit | 88738c09ab04fb10dc63204cb02f8992a43d1de0 (patch) | |
tree | d9fa68f5c139136489ddacff86f1b49583f82385 /bswap.h | |
parent | f94f7181950b9d028a919274f4787076242690b5 (diff) | |
download | hqemu-88738c09ab04fb10dc63204cb02f8992a43d1de0.zip hqemu-88738c09ab04fb10dc63204cb02f8992a43d1de0.tar.gz |
e1000: fix unaligned access
(Tristan Gingold)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4121 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'bswap.h')
-rw-r--r-- | bswap.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -132,6 +132,7 @@ CPU_CONVERT(le, 64, uint64_t) #define cpu_to_le32wu(p, v) cpu_to_le32w(p, v) #define le16_to_cpupu(p) le16_to_cpup(p) #define le32_to_cpupu(p) le32_to_cpup(p) +#define be32_to_cpupu(p) be32_to_cpup(p) #define cpu_to_be16wu(p, v) cpu_to_be16w(p, v) #define cpu_to_be32wu(p, v) cpu_to_be32w(p, v) @@ -168,6 +169,12 @@ static inline uint32_t le32_to_cpupu(const uint32_t *p) return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24); } +static inline uint32_t be32_to_cpupu(const uint32_t *p) +{ + const uint8_t *p1 = (const uint8_t *)p; + return p1[3] | (p1[2] << 8) | (p1[1] << 16) | (p1[0] << 24); +} + static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) { uint8_t *p1 = (uint8_t *)p; |