From a5fdab452f682e50cc05d6f392f750473fd93e78 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sun, 18 Apr 2010 02:02:35 +0200 Subject: Python: Use range instead of xrange. For small numbers range seems to be faster, and xramge is being removed anyway in Python 3 AFAIK. --- scripts/transitioncounter.py | 12 ++++++------ 1 file 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" -- cgit v1.2.3-70-g09d2