summaryrefslogtreecommitdiff
path: root/scripts/transitioncounter.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2010-04-18 02:02:35 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2010-04-18 02:02:35 +0200
commita5fdab452f682e50cc05d6f392f750473fd93e78 (patch)
tree9783b2d3fa18bdc2ef18a0b1118395390beb55a0 /scripts/transitioncounter.py
parent2454527da4eeb27683f64ffdc3311d4ac00b3a04 (diff)
downloadlibsigrokdecode-a5fdab452f682e50cc05d6f392f750473fd93e78.tar.gz
libsigrokdecode-a5fdab452f682e50cc05d6f392f750473fd93e78.zip
Python: Use range instead of xrange.
For small numbers range seems to be faster, and xramge is being removed anyway in Python 3 AFAIK.
Diffstat (limited to 'scripts/transitioncounter.py')
-rw-r--r--scripts/transitioncounter.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/transitioncounter.py b/scripts/transitioncounter.py
index 05a07e3..7c9c6a3 100644
--- a/scripts/transitioncounter.py
+++ b/scripts/transitioncounter.py
@@ -40,7 +40,7 @@ def sigrokdecode_count_transitions(inbuf):
# Presets...
oldbyte = inbuf[0]
- for i in xrange(channels):
+ for i in range(channels):
oldbit[i] = (oldbyte & (1 << i)) != 0
# Loop over all samples.
@@ -49,7 +49,7 @@ def sigrokdecode_count_transitions(inbuf):
# Optimization: Skip identical bytes (no transitions).
if oldbyte == s:
continue
- for i in xrange(channels):
+ for i in range(channels):
curbit = (s & (1 << i) != 0)
# Optimization: Skip identical bits (no transitions).
if oldbit[i] == curbit:
@@ -61,17 +61,17 @@ def sigrokdecode_count_transitions(inbuf):
oldbit[i] = curbit
# Total number of transitions is the sum of rising and falling edges.
- for i in xrange(channels):
+ for i in range(channels):
transitions[i] = rising[i] + falling[i]
outbuf += "Rising edges: "
- for i in xrange(channels):
+ for i in range(channels):
outbuf += str(rising[i]) + " "
outbuf += "\nFalling edges: "
- for i in xrange(channels):
+ for i in range(channels):
outbuf += str(falling[i]) + " "
outbuf += "\nTransitions: "
- for i in xrange(channels):
+ for i in range(channels):
outbuf += str(transitions[i]) + " "
outbuf += "\n"