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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Fri May 15 23:30:27 UTC 2020


Vadim Yanitskiy has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/25/18325/1

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: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200515/f41275df/attachment.htm>


More information about the gerrit-log mailing list