branch: externals/dismal commit 5a9900796dca7a16c2c68364f7fabb6a55450789 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
* heaps.el (heap-insert): Fix thinko in last change --- heaps.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/heaps.el b/heaps.el index 42b1c49..29eb10f 100644 --- a/heaps.el +++ b/heaps.el @@ -1,6 +1,6 @@ ;;; heaps.el --- Some kind of heap data structure of Dismal -;; Copyright (C) 1992, 2013 Free Software Foundation, Inc. +;; Copyright (C) 1992-2021 Free Software Foundation, Inc. ;; Author: David Fox, f...@cs.nyu.edu ;; Created-On: Mon Jan 6 14:19:10 1992 @@ -117,8 +117,9 @@ Argument H " ;; Put the new element in the next free position in the heap vector (heap-aset heap (heap-last heap) element) ;; Increment the element count - (if (> index 0) - (heap--bubble-up heap (heap-last heap))) + (let ((last (heap-last heap))) + (if (> last 0) + (heap--bubble-up heap last))) (heap-set-last heap (1+ (heap-last heap))))) (defun heap-deletemin (heap)