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

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jul 17 21:23:19 UTC 2019


fixeria has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/14825/1

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: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190717/9982baab/attachment.html>


More information about the gerrit-log mailing list