From c7172e5fa77d5cd56f206c4991762ce33ef78eba Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sun, 1 Jul 2018 15:26:09 +0200 Subject: common: rephrase bitpack(), use list comprehension Python idiom --- decoders/common/srdhelper/mod.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'decoders') diff --git a/decoders/common/srdhelper/mod.py b/decoders/common/srdhelper/mod.py index 3c495b4..e37345a 100644 --- a/decoders/common/srdhelper/mod.py +++ b/decoders/common/srdhelper/mod.py @@ -25,10 +25,7 @@ def bin2int(s: str): return int('0b' + s, 2) def bitpack(bits): - res = 0 - for i, b in enumerate(bits): - res |= b << i - return res + return sum([b << i for i, b in enumerate(bits)]) def bitunpack(num, minbits=0): res = [] -- cgit v1.2.3-70-g09d2