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.hender...@linaro.org>


r~

Reply via email to