maxikrie commented on code in PR #18117:
URL: https://github.com/apache/nuttx/pull/18117#discussion_r2722128790


##########
arch/arm/src/nrf52/nrf52_tim_lowerhalf.c:
##########
@@ -373,7 +373,7 @@ static int nrf52_timer_settimeout(struct timer_lowerhalf_s 
*lower,
       goto errout;
     }
 
-  cc = (timeout * NRF52_TIMER_PER / 1000000);
+  cc = (timeout * (1000000 / NRF52_TIMER_PER));

Review Comment:
   You are absolutely right, thanks for pointing this out! I was trying to 
correct the overflow issue caused by first multiplying timeout * 
NRF52_TIMER_PER and then division by 1000000. To correct, I copied from 
   `#define NRF52_TIMER_MAXTIMEOUT (NRF52_TIMER_MAX * (1000000 / 
NRF52_TIMER_PER))` in the same file, which only worked since NRF52_TIMER_PER is 
defined as 1000000. I will propose a corrected version!
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to