提交 e73d6e3a 编写于 作者: M Michael S. Tsirkin

bwap: add qemu_bswap helper

add helper that can swap values of 4, 2, 1 bytes
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 186993ee
......@@ -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 */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册