[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ibex_uart: fix XOR-as-pow
From: |
Alistair Francis |
Subject: |
Re: [PATCH] ibex_uart: fix XOR-as-pow |
Date: |
Tue, 23 Jun 2020 16:26:55 -0700 |
On Tue, Jun 23, 2020 at 1:07 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The xor-as-pow warning in clang actually detected a genuine bug.
> Fix it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/char/ibex_uart.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c
> index 3e0dd9968e..45cd724998 100644
> --- a/hw/char/ibex_uart.c
> +++ b/hw/char/ibex_uart.c
> @@ -331,7 +331,7 @@ static void ibex_uart_write(void *opaque, hwaddr addr,
> if (value & UART_CTRL_NCO) {
> uint64_t baud = ((value & UART_CTRL_NCO) >> 16);
> baud *= 1000;
> - baud /= 2 ^ 20;
> + baud >>= 20;
Whoops, that is clearly wrong. Thanks for catching this.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
>
> s->char_tx_time = (NANOSECONDS_PER_SECOND / baud) * 10;
> }
> --
> 2.26.2
>
>