[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_nib/arsm: ensure proper int width in backoff calculation (#10369)

Gaƫtan Harter notifications at github.com
Tue Feb 12 14:46:23 CET 2019


cladmi commented on this pull request.



> @@ -519,7 +519,7 @@ static inline uint32_t _exp_backoff_retrans_timer(uint8_t ns_sent,
 
     /* backoff according to  https://tools.ietf.org/html/rfc7048 with
      * BACKOFF_MULTIPLE == 2 */
-    tmp = ((1 << ns_sent) * retrans_timer * tmp) / US_PER_MS;
+    tmp = ((((uint32_t) 1) << ns_sent) * retrans_timer * tmp) / US_PER_MS;

The needed code is to the `<< ns_sent` on an `uint32_t` only. There is not technical reason to do it as `uint64_t` from this point. So I would keep the version with twe casts as it is now.

-- 
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/10369#discussion_r255958355
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190212/1b77b9de/attachment-0001.html>


More information about the notifications mailing list