diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-19 21:27:03 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-20 05:27:38 +0000 |
commit | dc6b9dfcd635a1ca97a218bcdaf16a2ee5f7b693 (patch) | |
tree | 49ce29aca0c5cce7f14b06b7bd89d7a1a35614b4 /epan/dissectors/packet-nas_eps.c | |
parent | e4787a9190c82dadae7e57c0847e2529bb2a9bbf (diff) |
Define macros to calculate (2^N)^M, and use them in more places.
Change-Id: I4df1b35d8d2233c301f0ba9e119d012aebe9cd17
Reviewed-on: https://code.wireshark.org/review/25913
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-nas_eps.c')
-rw-r--r-- | epan/dissectors/packet-nas_eps.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/epan/dissectors/packet-nas_eps.c b/epan/dissectors/packet-nas_eps.c index 980779a421..63018053d4 100644 --- a/epan/dissectors/packet-nas_eps.c +++ b/epan/dissectors/packet-nas_eps.c @@ -14,13 +14,13 @@ #include "config.h" -#include <math.h> #include <epan/packet.h> #include <epan/asn1.h> #include <epan/prefs.h> #include <epan/expert.h> #include <epan/exceptions.h> #include <epan/show_exception.h> +#include <wsutil/pow2.h> #include "packet-gsm_map.h" #include "packet-gsm_a_common.h" #include "packet-e212.h" @@ -3538,16 +3538,16 @@ get_ext_ambr_unit(guint32 byte, const char **unit_str) mult = 0; *unit_str = ""; } else if (byte <= 0x06) { - mult = (guint32)pow(4, byte-0x02); + mult = pow4(guint32, byte-0x02); *unit_str = "Mbps"; } else if (byte <= 0x0b) { - mult = (guint32)pow(4, byte-0x07); + mult = pow4(guint32, byte-0x07); *unit_str = "Gbps"; } else if (byte <= 0x10) { - mult = (guint32)pow(4, byte-0x0c); + mult = pow4(guint32, byte-0x0c); *unit_str = "Tbps"; } else if (byte <= 0x15) { - mult = (guint32)pow(4, byte-0x11); + mult = pow4(guint32, byte-0x11); *unit_str = "Pbps"; } else { mult = 256; @@ -3622,16 +3622,16 @@ get_ext_eps_qos_unit(guint32 byte, const char **unit_str) mult = 200; *unit_str = "kbps"; } else if (byte <= 0x06) { - mult = (guint32)pow(4, byte-0x02); + mult = pow4(guint32, byte-0x02); *unit_str = "Mbps"; } else if (byte <= 0x0b) { - mult = (guint32)pow(4, byte-0x07); + mult = pow4(guint32, byte-0x07); *unit_str = "Gbps"; } else if (byte <= 0x10) { - mult = (guint32)pow(4, byte-0x0c); + mult = pow4(guint32, byte-0x0c); *unit_str = "Tbps"; } else if (byte <= 0x15) { - mult = (guint32)pow(4, byte-0x11); + mult = pow4(guint32, byte-0x11); *unit_str = "Pbps"; } else { mult = 256; |