[pypy-commit] pypy vmprof: rpython fixes

fijal noreply at buildbot.pypy.org
Wed Feb 25 18:50:20 CET 2015


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: vmprof
Changeset: r76144:052d7e5d8a77
Date: 2015-02-25 19:49 +0200
http://bitbucket.org/pypy/pypy/changeset/052d7e5d8a77/

Log:	rpython fixes

diff --git a/rpython/rlib/rbisect.py b/rpython/rlib/rbisect.py
--- a/rpython/rlib/rbisect.py
+++ b/rpython/rlib/rbisect.py
@@ -1,20 +1,16 @@
 
-def bisect_left(a, x, hi=-1):
+def bisect_left(a, x, hi):
     """Return the index in the sorted list 'a' of 'x'.  If 'x' is not in 'a',
     return the index where it can be inserted."""
     lo = 0
-    if hi == -1:
-        hi = len(a)
     while lo < hi:
         mid = (lo+hi)//2
         if a[mid] < x: lo = mid+1
         else: hi = mid
     return lo
 
-def bisect_right(a, x, hi=-1):
+def bisect_right(a, x, hi):
     lo = 0
-    if hi == -1:
-        hi = len(a)
     while lo < hi:
         mid = (lo+hi)//2
         if x < a[mid]: hi = mid
@@ -22,20 +18,16 @@
     return lo
 
 # a copy of the above, but compares the item called 'addr' only
-def bisect_left_addr(a, x, hi=-1):
+def bisect_left_addr(a, x, hi):
     lo = 0
-    if hi == -1:
-        hi = len(a)
     while lo < hi:
         mid = (lo+hi)//2
         if a[mid].addr < x: lo = mid+1
         else: hi = mid
     return lo
 
-def bisect_right_addr(a, x, hi=-1):
+def bisect_right_addr(a, x, hi):
     lo = 0
-    if hi == -1:
-        hi = len(a)
     while lo < hi:
         mid = (lo+hi)//2
         if x < a[mid].addr: hi = mid


More information about the pypy-commit mailing list