Change in ...libosmocore[master]: bitvec/bitval2mask(): cosmetic: get rid of temporary int variable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Jul 18 09:07:53 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmocore/+/14825 )

Change subject: bitvec/bitval2mask(): cosmetic: get rid of temporary int variable
......................................................................

bitvec/bitval2mask(): cosmetic: get rid of temporary int variable

Change-Id: I9d6f6b66c99c43107d1ad3e80af332e967bb19e8
---
M src/bitvec.c
1 file changed, 4 insertions(+), 11 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/bitvec.c b/src/bitvec.c
index dac0401..0c263ad 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -58,25 +58,18 @@
 /* convert ZERO/ONE/L/H to a bitmask at given pos in a byte */
 static uint8_t bitval2mask(enum bit_value bit, uint8_t bitnum)
 {
-	int bitval;
-
 	switch (bit) {
 	case ZERO:
-		bitval = (0 << bitnum);
-		break;
+		return (0 << bitnum);
 	case ONE:
-		bitval = (1 << bitnum);
-		break;
+		return (1 << bitnum);
 	case L:
-		bitval = ((0x2b ^ (0 << bitnum)) & (1 << bitnum));
-		break;
+		return ((0x2b ^ (0 << bitnum)) & (1 << bitnum));
 	case H:
-		bitval = ((0x2b ^ (1 << bitnum)) & (1 << bitnum));
-		break;
+		return ((0x2b ^ (1 << bitnum)) & (1 << bitnum));
 	default:
 		return 0;
 	}
-	return bitval;
 }
 
 /*! check if the bit is 0 or 1 for a given position inside a bitvec

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14825
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9d6f6b66c99c43107d1ad3e80af332e967bb19e8
Gerrit-Change-Number: 14825
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190718/b51a1f8a/attachment.htm>


More information about the gerrit-log mailing list