qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pe


From: Richard Henderson
Subject: Re: [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code
Date: Sat, 9 Apr 2022 13:21:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 4/8/22 07:15, Peter Maydell wrote:
+    if (extract32(pend, irq % 8, 1) == level) {

Here you assume level in {0,1}...

+    pend = deposit32(pend, irq % 8, 1, level ? 1 : 0);

... and here you force it into {0,1}.
Better to have the compiler do that with bool level.

You might consider

    uint8_t bit = 1 << (irq % 8);
    read();
    if (!(pend & bit) ^ level) {
       no change
    }
    pend ^= bit;
    write();

as a follow up; extract + deposit seems unnecessary.

Anyway, with the bool thing fixed,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]