On Thu, 27 Jul 2023 at 16:43, Peter Maydell <peter.maydell@xxxxxxxxxx> wrote: > > On Tue, 25 Jul 2023 at 16:01, Shameer Kolothum > <shameerali.kolothum.thodi@xxxxxxxxxx> wrote: > > +static bool kvm_arm_eager_split_size_valid(uint64_t req_size, uint32_t sizes) > > +{ > > + int i; > > + > > + for (i = 0; i < sizeof(uint32_t) * BITS_PER_BYTE; i++) { > > + if (!(sizes & (1 << i))) { > > + continue; > > + } > > + > > + if (req_size == (1 << i)) { > > + return true; > > + } > > + } > > We know req_size is a power of 2 here, so if you also explicitly > rule out 0 then you can do > return sizes & (1 << ctz64(req_size)); Er, that's also over-complicated. Just return sizes & req_size; should do (and catches the 0 case correctly again). -- PMM