[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_nib/arsm: ensure proper int width in backoff calculation (#10369)
notifications at github.com
Tue Jan 29 14:49:16 CET 2019
cgundogan commented on this pull request.
> + * @pre (NDP_MIN_RANDOM_FACTOR <= factor < NDP_MAX_RANDOM_FACTOR)
+ * @pre (ns_sent <= NDP_MAX_NS_NUMOF)
+ * @return exponential back-off of the retransmission timer
+static inline uint32_t _exp_backoff_retrans_timer_factor(uint8_t ns_sent,
+ uint32_t retrans_timer,
+ uint32_t factor)
+ assert(NDP_MIN_RANDOM_FACTOR <= factor);
+ assert(factor < NDP_MAX_RANDOM_FACTOR);
+ assert(ns_sent <= NDP_MAX_NS_NUMOF);
+ /* backoff according to https://tools.ietf.org/html/rfc7048 with
+ * BACKOFF_MULTIPLE == 2 */
+ uint32_t res = (uint32_t)(((uint64_t)(((uint32_t) 1) << ns_sent) *
+ retrans_timer * factor) / US_PER_MS);
>Because (as stated in the comment below) factor is multiplied with 1000.
The typical developer would probably expect comments to be above the code line (;
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications