diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-10-10 15:44:19 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-10-10 15:44:19 +0000 |
commit | 188d857911636fa43628eb8a7beeab4702636317 (patch) | |
tree | 8a907e76d2a08d23a9c496074f2d8b59d9ac9818 /bswap.h | |
parent | 9bc9d1c75abf23b1a11c8e633fe5eeb3d6d4c8d3 (diff) |
limited 8 bit support - removed unaligned memory accesses in VGA (initial patch by Johannes Schindelin)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1116 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'bswap.h')
-rw-r--r-- | bswap.h | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -133,6 +133,9 @@ CPU_CONVERT(le, 64, uint64_t) #define le16_to_cpupu(p) le16_to_cpup(p) #define le32_to_cpupu(p) le32_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) + #else static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) @@ -165,6 +168,30 @@ 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 void cpu_to_be16wu(uint16_t *p, uint16_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v >> 8; + p1[1] = v; +} + +static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v >> 24; + p1[1] = v >> 16; + p1[2] = v >> 8; + p1[3] = v; +} + +#endif + +#ifdef WORDS_BIGENDIAN +#define cpu_to_32wu cpu_to_be32wu +#else +#define cpu_to_32wu cpu_to_le32wu #endif #undef le_bswap |