From: Michael S. Tsirkin Date: Thu, 14 Jan 2010 13:58:52 +0000 (+0200) Subject: bwap: add qemu_bswap helper X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~8710^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e73d6e3a028c777e642c687d433db914d8be8679;p=sdk%2Femulator%2Fqemu.git bwap: add qemu_bswap helper add helper that can swap values of 4, 2, 1 bytes Signed-off-by: Michael S. Tsirkin --- diff --git a/bswap.h b/bswap.h index 4558704..aace9b7 100644 --- a/bswap.h +++ b/bswap.h @@ -214,4 +214,10 @@ static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) #undef le_bswaps #undef be_bswaps +/* len must be one of 1, 2, 4 */ +static inline uint32_t qemu_bswap_len(uint32_t value, int len) +{ + return bswap32(value) >> (32 - 8 * len); +} + #endif /* BSWAP_H */