lkml.org 
[lkml]   [2021]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [v8 2/2] pwm: Add Aspeed ast2600 PWM support
Hello Billy,

On Fri, Jul 09, 2021 at 05:40:45AM +0000, Billy Tsai wrote:
> On 2021/7/2, 10:32 PM, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> wrote:
> > The multiplication can be up to:
>
> > 100000000 * (1 << 31) * (31 + 1) * (255 + 1)
>
> > right? This needs 71 bits and so might overflow a u64.
>
> No, the multiplication can be up to:
>
> Max(div_h) = 15
> Max(div_l) = 255
> Max(clk_period) = 255
> 1000000000 * (1 << 15) * (255 + 1) * (255 + 1) < 2^64 - 1
> it doesn't overflow a u64.

Ah, you're right. Please note this in a comment (not that you were
right, but that it doesn't overflow :-)

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-07-09 07:55    [W:0.083 / U:2.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site