Fix-Point commented on code in PR #18224:
URL: https://github.com/apache/nuttx/pull/18224#discussion_r2735561881


##########
sched/hrtimer/hrtimer_start.c:
##########
@@ -90,21 +72,21 @@ int hrtimer_start(FAR hrtimer_t *hrtimer, hrtimer_entry_t 
func,
 
   hrtimer_cancel_running(hrtimer);
 
-  if (hrtimer_is_armed(hrtimer))
+  if (hrtimer_is_pending(hrtimer))
     {
-      hrtimer_remove(hrtimer);
+      reassess = hrtimer_remove(hrtimer);
     }
 
   hrtimer->func    = func;
-  hrtimer->expired = next_expired;

Review Comment:
   This commit inlined the `hrtimer_start` to allow the compiler to optimize at 
least 1 branch in
   hrtimer_start. Since the `hrtimer_mode_e` should be a **constant value and 
can be evaluated in compile-time**.



-- 
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