From fb24d4f25cacbc1fac061300692235ca17064cf0 Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Wed, 16 Oct 2019 16:24:38 +0200 Subject: [PATCH] minor speed improvements --- pyModeS/decoder/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyModeS/decoder/common.py b/pyModeS/decoder/common.py index 08fdf4d..d11718c 100644 --- a/pyModeS/decoder/common.py +++ b/pyModeS/decoder/common.py @@ -43,8 +43,8 @@ def np2bin(npbin): def df(msg): """Decode Downlink Format vaule, bits 1 to 5.""" - msgbin = hex2bin(msg) - return min(bin2int(msgbin[0:5]), 24) + dfbin = hex2bin(msg[:2]) + return min(bin2int(dfbin[0:5]), 24) def crc(msg, encode=False): @@ -195,8 +195,8 @@ def typecode(msg): if df(msg) not in (17, 18): return None - msgbin = hex2bin(msg) - return bin2int(msgbin[32:37]) + tcbin = hex2bin(msg[8:10]) + return bin2int(tcbin[0:5]) def cprNL(lat):