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 <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-02-19 18:43:00 -08:00
parent 5c0cf42243
commit e4787a9190
1 changed files with 1 additions and 3 deletions

View File

@ -23,8 +23,6 @@
#include "config.h"
#include "math.h"
#include <epan/packet.h>
#include <epan/in_cksum.h>
#include <epan/ipproto.h>
@ -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)");