From e4787a9190c82dadae7e57c0847e2529bb2a9bbf Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 19 Feb 2018 18:43:00 -0800 Subject: [PATCH] Don't use floating point to calculate 4^N, for integer N. You don't need floating-point, you can just calculate 1<<2N. Change-Id: Iec9ebf02bba3e8bcce344be7f0366f7f258da403 Reviewed-on: https://code.wireshark.org/review/25912 Reviewed-by: Guy Harris --- epan/dissectors/packet-icmpv6.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 4766893a33..b4d570e13f 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -23,8 +23,6 @@ #include "config.h" -#include "math.h" - #include #include #include @@ -2997,7 +2995,7 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree } } - proto_item_append_text(ti_opt_lifetime, " (%d sec)", (int) pow(4.0, (lt_mr_nh & RPL_OPT_ROUTE_DISCOVERY_L) >> 6)); + proto_item_append_text(ti_opt_lifetime, " (%u sec)", 1U << ((lt_mr_nh & RPL_OPT_ROUTE_DISCOVERY_L) >> 6)*2); if (!(lt_mr_nh & RPL_OPT_ROUTE_DISCOVERY_MR_NH)) { proto_item_append_text(ti_opt_mr_nh, " (Infinity)");