Change in osmocom-bb[master]: trx_toolkit/rand_burst_gen.py: use list comprehension

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat May 16 20:17:18 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/18325 )

Change subject: trx_toolkit/rand_burst_gen.py: use list comprehension
......................................................................

trx_toolkit/rand_burst_gen.py: use list comprehension

See previous commit, TL;DR this approach is significantly faster.

Change-Id: I5dc0dda89443d2763bfae50cc402724935cc91b3
---
M src/target/trx_toolkit/rand_burst_gen.py
1 file changed, 5 insertions(+), 10 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/target/trx_toolkit/rand_burst_gen.py b/src/target/trx_toolkit/rand_burst_gen.py
index be4b696..a56467f 100644
--- a/src/target/trx_toolkit/rand_burst_gen.py
+++ b/src/target/trx_toolkit/rand_burst_gen.py
@@ -57,8 +57,7 @@
 		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 @@
 		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 @@
 		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 @@
 		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 @@
 		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

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/18325
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I5dc0dda89443d2763bfae50cc402724935cc91b3
Gerrit-Change-Number: 18325
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200516/030014a6/attachment.htm>


More information about the gerrit-log mailing list