Fix-Point commented on code in PR #20057:
URL: https://github.com/apache/nuttx/pull/20057#discussion_r3946144424
##########
drivers/timers/arch_alarm.c:
##########
@@ -288,16 +289,7 @@ void weak_function up_timer_getmask(FAR clock_t *mask)
ONESHOT_TICK_MAX_DELAY(g_oneshot_lower, &maxticks);
- for (; ; )
- {
- clock_t next = (*mask << 1) | 1;
- if (next > maxticks)
- {
- break;
- }
-
- *mask = next;
- }
+ *mask = CLOCK_MAX >> (sizeof(clock_t) * 8u - flsx(maxticks));
Review Comment:
Fixed.
##########
drivers/timers/arch_timer.c:
##########
@@ -280,17 +282,7 @@ void weak_function up_timer_getmask(FAR clock_t *mask)
TIMER_TICK_MAXTIMEOUT(g_timer.lower, &maxticks);
- *mask = 0;
- while (1)
- {
- clock_t next = (*mask << 1) | 1;
- if (next > maxticks)
- {
- break;
- }
-
- *mask = next;
- }
+ *mask = CLOCK_MAX >> (sizeof(clock_t) * 8u - flsx(maxticks));
Review Comment:
Fixed.
--
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]