On Thu, 8 Oct 2020 at 11:43, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>
> On Thu, 8 Oct 2020 at 13:27, Peter Maydell <peter.mayd...@linaro.org> wrote:
> >
> > On Thu, 8 Oct 2020 at 11:21, Maxim Uvarov <maxim.uva...@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

Reply via email to