From df551b8cb7721ccee775c16b831d9c3fafa5e707 Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Mon, 7 Mar 2016 22:21:35 +0100 Subject: [PATCH] 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 Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte Reviewed-by: Michael Mann --- wsutil/sign_ext.h | 4 ++-- 1 file 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; /*