summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-16 06:27:27 +0700
committerlaforge <laforge@osmocom.org>2020-05-16 20:17:18 +0000
commit2db781a5d77e1c4bc3ae8517e7ba7946ac71a1a7 (patch)
tree704567a17cb96cba970fa64b081c1287285b8c0a
parent86b621b36b1e4d406fc75043930559ef7a1d6da4 (diff)
trx_toolkit/rand_burst_gen.py: use list comprehension
See previous commit, TL;DR this approach is significantly faster. Change-Id: I5dc0dda89443d2763bfae50cc402724935cc91b3
-rw-r--r--src/target/trx_toolkit/rand_burst_gen.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/target/trx_toolkit/rand_burst_gen.py b/src/target/trx_toolkit/rand_burst_gen.py
index be4b6961..a56467f8 100644
--- a/src/target/trx_toolkit/rand_burst_gen.py
+++ b/src/target/trx_toolkit/rand_burst_gen.py
@@ -57,8 +57,7 @@ class RandBurstGen:
buf += [0] * 3
# Random data 1 / 2
- for i in range(0, 57):
- buf.append(random.randint(0, 1))
+ buf += [random.randint(0, 1) for i in range(57)]
# Steal flag 1 / 2
buf.append(random.randint(0, 1))
@@ -72,8 +71,7 @@ class RandBurstGen:
buf.append(random.randint(0, 1))
# Random data 2 / 2
- for i in range(0, 57):
- buf.append(random.randint(0, 1))
+ buf += [random.randint(0, 1) for i in range(57)]
# Tailing bits
buf += [0] * 3
@@ -92,8 +90,7 @@ class RandBurstGen:
buf += [0] * 3
# Random data 1 / 2
- for i in range(0, 39):
- buf.append(random.randint(0, 1))
+ buf += [random.randint(0, 1) for i in range(39)]
# Training sequence
if tsc is None:
@@ -101,8 +98,7 @@ class RandBurstGen:
buf += tsc.seq
# Random data 2 / 2
- for i in range(0, 39):
- buf.append(random.randint(0, 1))
+ buf += [random.randint(0, 1) for i in range(39)]
# Tailing bits
buf += [0] * 3
@@ -126,8 +122,7 @@ class RandBurstGen:
buf += tsc.seq
# Random data
- for i in range(0, 36):
- buf.append(random.randint(0, 1))
+ buf += [random.randint(0, 1) for i in range(36)]
# Tailing bits
buf += [0] * 3