range: Introduce range_get_last_bit()
commit6f274444c579305d14d355bab24af31ea2bef224
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Wed, 5 Jun 2024 08:30:31 +0000 (5 16:30 +0800)
committerCédric Le Goater <clg@redhat.com>
Mon, 24 Jun 2024 21:15:30 +0000 (24 23:15 +0200)
tree6054ac4f2962035c04b000c0064dff570548adec
parent9005f928447841ed253e000d5e8220e381872cb0
range: Introduce range_get_last_bit()

This helper get the highest 1 bit position of the upper bound.

If the range is empty or upper bound is zero, -1 is returned.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
include/qemu/range.h