summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2020-07-23 17:27:17 +0200
committerGerhard Sittig <gerhard.sittig@gmx.net>2020-07-26 14:38:18 +0200
commita9e9573999e59154192a73dda0e9ad36868d6fbe (patch)
treebc26ee9bd42cfc9204c3e485c7793bdc72ff2437
parentae3ed2954e8c4428c6a43922bd03741136cdb354 (diff)
downloadlibsigrokdecode-a9e9573999e59154192a73dda0e9ad36868d6fbe.tar.gz
libsigrokdecode-a9e9573999e59154192a73dda0e9ad36868d6fbe.zip
ir_sirc: use common bitpack() variant with array access
This eliminates array copies and indexed access to bit values in the calling decoder. Prefer common helpers instead.
-rw-r--r--decoders/ir_sirc/pd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/ir_sirc/pd.py b/decoders/ir_sirc/pd.py
index d4fed65..14ba63f 100644
--- a/decoders/ir_sirc/pd.py
+++ b/decoders/ir_sirc/pd.py
@@ -17,7 +17,7 @@
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
-from common.srdhelper import bitpack
+from common.srdhelper import bitpack_lsb
from .lists import ADDRESSES
import sigrokdecode as srd
@@ -168,8 +168,8 @@ class Decoder(srd.Decoder):
raise SIRCError('incorrect bits count {}'.format(len(bits)))
break
- command_num = bitpack([b[0] for b in command])
- address_num = bitpack([b[0] for b in address])
+ command_num = bitpack_lsb(command, 0)
+ address_num = bitpack_lsb(address, 0)
command_str = '0x{:02X}'.format(command_num)
address_str = '0x{:02X}'.format(address_num)
self.putg(command[0][1], command[-1][2], Ann.CMD, [
@@ -182,7 +182,7 @@ class Decoder(srd.Decoder):
])
extended_num = None
if extended:
- extended_num = bitpack([b[0] for b in extended])
+ extended_num = bitpack_lsb(extended, 0)
extended_str = '0x{:02X}'.format(extended_num)
self.putg(extended[0][1], extended[-1][2], Ann.EXT, [
'Extended: {}'.format(extended_str),