From: Madhumitha Prabakaran <madhumithabiw@gmail.com>
To: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Cc: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Subject: [PATCH v2] Staging: rtlwifi: Remove unwanted parentheses
Date: Wed, 3 Apr 2019 17:38:51 -0500 [thread overview]
Message-ID: <20190403223851.22524-1-madhumithabiw@gmail.com> (raw)
Remove unwanted parentheses and use !! idiom in place of ternary
operator to make code simple and more understandable.
Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
Changes in v2:
- Changed commit log
- Replaced ternary operator with !! idiom
- Modified a BIT operator
---
drivers/staging/rtlwifi/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtlwifi/core.c b/drivers/staging/rtlwifi/core.c
index a9902818ae7e..c70f062cf4b9 100644
--- a/drivers/staging/rtlwifi/core.c
+++ b/drivers/staging/rtlwifi/core.c
@@ -341,8 +341,8 @@ static u16 crc16_ccitt(u8 data, u16 crc)
u16 result;
for (i = 0; i < 8; i++) {
- crc_bit15 = ((crc & BIT(15)) ? 1 : 0);
- data_bit = (data & (BIT(0) << i) ? 1 : 0);
+ crc_bit15 = !!(crc & BIT(15));
+ data_bit = !!(data & BIT(i));
shift_in = crc_bit15 ^ data_bit;
result = crc << 1;
@@ -351,13 +351,13 @@ static u16 crc16_ccitt(u8 data, u16 crc)
else
result |= BIT(0);
- crc_bit11 = ((crc & BIT(11)) ? 1 : 0) ^ shift_in;
+ crc_bit11 = !!(crc & BIT(11)) ^ shift_in;
if (crc_bit11 == 0)
result &= (~BIT(12));
else
result |= BIT(12);
- crc_bit4 = ((crc & BIT(4)) ? 1 : 0) ^ shift_in;
+ crc_bit4 = !!(crc & BIT(4)) ^ shift_in;
if (crc_bit4 == 0)
result &= (~BIT(5));
else
--
2.17.1
next reply other threads:[~2019-04-03 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 22:38 Madhumitha Prabakaran [this message]
2019-04-04 9:09 ` [PATCH v2] Staging: rtlwifi: Remove unwanted parentheses Dan Carpenter
2019-04-04 19:56 ` Madhumthia Prabakaran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190403223851.22524-1-madhumithabiw@gmail.com \
--to=madhumithabiw@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox