Revision: 58883
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58883
Author: campbellbarton
Date: 2013-08-03 22:04:47 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
minor changes to BLI_heap, save some CPU cycles.
added an assert for incorrect use of BLI_heap_remove
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/BLI_heap.c
Modified: trunk/blender/source/blender/blenlib/intern/BLI_heap.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_heap.c 2013-08-03
22:03:15 UTC (rev 58882)
+++ trunk/blender/source/blender/blenlib/intern/BLI_heap.c 2013-08-03
22:04:47 UTC (rev 58883)
@@ -163,7 +163,7 @@
{
HeapNode *node;
- if (UNLIKELY((heap->size + 1) > heap->bufsize)) {
+ if (UNLIKELY(heap->size >= heap->bufsize)) {
heap->bufsize *= 2;
heap->tree = MEM_reallocN(heap->tree, heap->bufsize *
sizeof(*heap->tree));
}
@@ -184,7 +184,7 @@
heap->size++;
- heap_up(heap, heap->size - 1);
+ heap_up(heap, node->index);
return node;
}
@@ -230,6 +230,8 @@
{
unsigned int i = node->index;
+ BLI_assert(heap->size != 0);
+
while (i > 0) {
unsigned int p = HEAP_PARENT(i);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs