[riot-notifications] [RIOT-OS/RIOT] Refactor evtimer add del (#10717)

Marian Buschsieweke notifications at github.com
Wed Jul 3 20:29:28 CEST 2019


maribu commented on this pull request.



>  {
     DEBUG("evtimer: new event offset %" PRIu32 " ms\n", event->offset);
-    /* we want list->next to point to the first list element. thus we take the
-     * *address* of evtimer->events, then cast it from (evtimer_event_t **) to
-     * (evtimer_event_t*). After that, list->next actually equals
-     * evtimer->events. */
-    evtimer_event_t *list = (evtimer_event_t *)&evtimer->events;
-
-    while (list->next) {
-        evtimer_event_t *list_entry = list->next;
+    evtimer_event_t **list = &evtimer->events;

Note that I deliberately did not mark this comment as "changes requested".

But out of curiosity I did compare the assembly emitted from GCC and clang. Your code and the current master are translated to the exact same assembly with clang8 on x86 with my suggestion being a bit longer. With GCC 8.3.0 on ARM your code is translated to the shortest assembly, followed by the master code and my code being the longest. With GCC 8.3.0 on x86 your code translates again to the shortest assembly, followed by my code with the current master being the longest.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10717#discussion_r300099470
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190703/ca149fd3/attachment-0001.html>


More information about the notifications mailing list