[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/2] hw/watchdog: Implement SBSA watchdog device
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 1/2] hw/watchdog: Implement SBSA watchdog device |
Date: |
Thu, 8 Oct 2020 15:08:59 +0100 |
On Thu, 8 Oct 2020 at 11:43, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> On Thu, 8 Oct 2020 at 13:27, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > On Thu, 8 Oct 2020 at 11:21, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> > > Interesting why gcc does not warn on 64bit signed to 32bit unsigned
> > > truncation here. Looks like it's too smart to understand
> > > that value fits in 32 bits.
> >
> > What truncation? 1000000000 in decimal is 0x3B9ACA00 in hex:
> > the number fits in an 32 bit integer without truncation.
> I meant that LL is an long long int which is 64 bit size type. And
> then you pass it to uint32_t.
Yes, that's fine, because it fits. The LL ensures that if
you do a calculation like:
uint64_t max_timeout = 16 * NANOSECONDS_PER_SECOND;
it isn't incorrectly done as 32-bit arithmetic.
thanks
-- PMM