summaryrefslogtreecommitdiff
path: root/wsutil/sign_ext.h
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2016-03-07 22:21:35 +0100
committerMichael Mann <mmann78@netscape.net>2016-03-16 01:08:27 +0000
commitdf551b8cb7721ccee775c16b831d9c3fafa5e707 (patch)
tree4f928d85cb8266bd130734ef5e978baa6ddf4ff8 /wsutil/sign_ext.h
parentec2c9a1e61dac269cc87185e15316a17fefe78b0 (diff)
downloadwireshark-df551b8cb7721ccee775c16b831d9c3fafa5e707.tar.gz
No need to operate on full bit width (CID 1355344 / 1355348)
When giving the full bit width to sign extend there's nothing left, so return the value straight away (a NULL op). Change-Id: I48e6612b6a7c89c0a9ddad0974bb83e7c8e0c22d Reviewed-on: https://code.wireshark.org/review/14390 Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wsutil/sign_ext.h')
-rw-r--r--wsutil/sign_ext.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/wsutil/sign_ext.h b/wsutil/sign_ext.h
index e680361401..eb330f17ad 100644
--- a/wsutil/sign_ext.h
+++ b/wsutil/sign_ext.h
@@ -32,7 +32,7 @@ ws_sign_ext32(guint32 val, int no_of_bits)
{
g_assert (no_of_bits >= 0 && no_of_bits <= 32);
- if (no_of_bits == 0)
+ if ((no_of_bits == 0) || (no_of_bits == 32))
return val;
/*
@@ -52,7 +52,7 @@ ws_sign_ext64(guint64 val, int no_of_bits)
{
g_assert (no_of_bits >= 0 && no_of_bits <= 64);
- if (no_of_bits == 0)
+ if ((no_of_bits == 0) || (no_of_bits == 64))
return val;
/*