Good call, I can put it in the next version.

On Wed, Sep 24, 2025 at 6:11 PM Philippe Mathieu-Daudé <[email protected]>
wrote:

> On 25/9/25 02:58, Coco Li wrote:
> > Signed-off-by: Coco Li <[email protected]>
> > Reviewed-by: Hao Wu <[email protected]>
> > ---
> >   hw/gpio/npcm8xx_sgpio.c          | 134 ++++++++++++++++++++---
> >   include/hw/gpio/npcm8xx_sgpio.h  |   4 +-
> >   tests/qtest/npcm8xx_sgpio-test.c | 180 ++++++++++++++++++++++++++-----
> >   3 files changed, 274 insertions(+), 44 deletions(-)
> >
> > diff --git a/hw/gpio/npcm8xx_sgpio.c b/hw/gpio/npcm8xx_sgpio.c
>
>
> > +static uint8_t get_even_bits(uint16_t n)
> > +{
> > +    n &= 0x5555;
> > +
> > +    n = (n | (n >> 1)) & 0x3333;
> > +    n = (n | (n >> 2)) & 0x0F0F;
> > +    n = (n | (n >> 4)) & 0x00FF;
> > +
> > +    return (uint8_t)n;
> > +}
> > +
> > +static uint8_t get_odd_bits(uint16_t n)
> > +{
> > +    return get_even_bits(n >> 1);
> > +}
>
> Candidates for "include/qemu/bitops.h"?
>

Reply via email to