def _siftdown_max(heap, startpos, pos):
 newitem = heap[pos]
 while (pos > startpos):
  parentpos = ((pos - 1) >> 1)
  parent = heap[parentpos]
  if cmp_lt(parent, newitem):
   heap[pos] = parent
   pos = parentpos
   continue
  break
 heap[pos] = newitem

def _siftdown_max ( heap , startpos , pos ) : newitem = heap [ pos ] while ( pos > startpos ) : parentpos = ( ( pos - 1 ) >> 1 ) parent = heap [ parentpos ] if cmp_lt ( parent , newitem ) : heap [ pos ] = parent pos = parentpos continue break heap [ pos ] = newitem
maxheap variant of _siftdown .