diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-12-09 02:13:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-12-09 02:13:35 +0300 |
commit | 55812e3acd625aa93162cd9e0894efd43a1dd615 (patch) | |
tree | c41c77fac97adce2059e213f74f58e0c957de0f8 /source/blender/blenlib/intern/BLI_heap.c | |
parent | 03760fed0d433568b1dc6e46fb7b48c59a3300b5 (diff) |
Cleanup: simplify heap popmin
Diffstat (limited to 'source/blender/blenlib/intern/BLI_heap.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 1e616d1d495..05bd1074bf0 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -205,13 +205,8 @@ void *BLI_heap_popmin(Heap *heap) heap->tree[0]->ptr = heap->freenodes; heap->freenodes = heap->tree[0]; - if (UNLIKELY(heap->size == 1)) { - heap->size--; - } - else { - heap_swap(heap, 0, heap->size - 1); - heap->size--; - + if (--heap->size) { + heap_swap(heap, 0, heap->size); heap_down(heap, 0); } |