Re: [U-Boot] [PATCH 1/8] u8500: Correct unnecessary mathematical roll-over

2012-11-21 Thread Lee Jones
> > > > -#define COUNT_TO_USEC(x) ((x) * 16 / 133) > > > > +#define COUNT_TO_USEC(x) ((x) / 133 * 16) > > > > > > Before the change, the result is useful for all values of x in the > > > interval from 0 through UINT_MAX/16 = 268435455 = 268 seconds, i. e. > > > for all values that make

Re: [U-Boot] [PATCH 1/8] u8500: Correct unnecessary mathematical roll-over

2012-11-21 Thread Wolfgang Denk
Dear Lee Jones, In message <20121121100228.gj28...@gmail.com> you wrote: > > > > -#define COUNT_TO_USEC(x) ((x) * 16 / 133) > > > +#define COUNT_TO_USEC(x) ((x) / 133 * 16) > > > > Before the change, the result is useful for all values of x in the > > interval from 0 through UINT_MAX/16 = 2684354

Re: [U-Boot] [PATCH 1/8] u8500: Correct unnecessary mathematical roll-over

2012-11-21 Thread Lee Jones
> > If we attempt to take a 32bit timer value and multiply it by a > > significant number, the core will not be able to handle it. This > > gives the illusion that the timer is rolling over, when in fact > > this is not the case. If we ensure the division in this instance > > is carried out before

Re: [U-Boot] [PATCH 1/8] u8500: Correct unnecessary mathematical roll-over

2012-11-20 Thread Wolfgang Denk
Dear Lee Jones, In message <1353422034-28107-2-git-send-email-lee.jo...@linaro.org> you wrote: > If we attempt to take a 32bit timer value and multiply it by a > significant number, the core will not be able to handle it. This > gives the illusion that the timer is rolling over, when in fact > thi

[U-Boot] [PATCH 1/8] u8500: Correct unnecessary mathematical roll-over

2012-11-20 Thread Lee Jones
If we attempt to take a 32bit timer value and multiply it by a significant number, the core will not be able to handle it. This gives the illusion that the timer is rolling over, when in fact this is not the case. If we ensure the division in this instance is carried out before the multiplication,