diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2018-07-01 15:26:09 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-07-15 20:16:39 +0200 |
commit | c7172e5fa77d5cd56f206c4991762ce33ef78eba (patch) | |
tree | 6c78b82dfd27728816a6df6083793e327d6e5114 /decoders/common | |
parent | 288e22b0cfe75e52e68c5ca2e586b47e26ccf91a (diff) | |
download | libsigrokdecode-c7172e5fa77d5cd56f206c4991762ce33ef78eba.tar.gz libsigrokdecode-c7172e5fa77d5cd56f206c4991762ce33ef78eba.zip |
common: rephrase bitpack(), use list comprehension Python idiom
Diffstat (limited to 'decoders/common')
-rw-r--r-- | decoders/common/srdhelper/mod.py | 5 |
1 files changed, 1 insertions, 4 deletions
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 = [] |