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 <axilira...@gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@gnumonks.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to