summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-17 16:41:17 +0700
committerlaforge <laforge@gnumonks.org>2019-07-18 09:07:53 +0000
commit00a55ae7fe6cc40a0c375a1a7989157e2e0b1879 (patch)
tree5d8fb4887076227578308e9f363b55ae7ffa32f0
parent74474cf8a6b1440927c7ba34a5610847dd89c698 (diff)
bitvec/bitval2mask(): cosmetic: get rid of temporary int variable
Change-Id: I9d6f6b66c99c43107d1ad3e80af332e967bb19e8
-rw-r--r--src/bitvec.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/bitvec.c b/src/bitvec.c
index dac04018..0c263ad6 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -58,25 +58,18 @@ static inline unsigned int bytenum_from_bitnum(unsigned int bitnum)
/* 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