提交 e3093663 编写于 作者: M Marc-André Lureau

ivshmem: use common is_power_of_2()

The common version correctly checks for 0 value case.
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NClaudio Fontana <claudio.fontana@huawei.com>
上级 6f8a16d5
......@@ -117,10 +117,6 @@ static inline uint32_t ivshmem_has_feature(IVShmemState *ivs,
return (ivs->features & (1 << feature));
}
static inline bool is_power_of_two(uint64_t x) {
return (x & (x - 1)) == 0;
}
/* accessing registers - based on rtl8139 */
static void ivshmem_update_irq(IVShmemState *s)
{
......@@ -632,7 +628,7 @@ static uint64_t ivshmem_get_size(IVShmemState * s, Error **errp) {
}
/* BARs must be a power of 2 */
if (!is_power_of_two(value)) {
if (!is_power_of_2(value)) {
error_setg(errp, "size must be power of 2");
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册