graph: heap: Cast known integer after division.

This commit is contained in:
Stefan van der Walt
2009-12-31 10:54:25 +02:00
parent 07fbf605b2
commit b7706e6550
+4 -2
View File
@@ -1,3 +1,5 @@
# -*- python -*-
"""Cython implementation of a binary min heap.
Original author: Almar Klein
@@ -244,7 +246,7 @@ cdef class BinaryHeap:
i0 = (1 << level) - 1 #2**level-1 = LevelStart
n = i0 + 1 #2**level
for i in range(i0,i0+n,2):
ii = (i-1)/2 # CalcPrevAbs
ii = (int)(i-1)/2 # CalcPrevAbs
if values[i] < values[i+1]:
values[ii] = values[i]
else:
@@ -264,7 +266,7 @@ cdef class BinaryHeap:
# track tree
cdef int ii, level
for level in range(self.levels,1,-1):
ii = (i-1)/2 # CalcPrevAbs
ii = (int)(i-1)/2 # CalcPrevAbs
# test
if values[i] < values[i+1]:
values[ii] = values[i]