| 259 | |
| 260 | |
| 261 | inline HeapEntry* HeapList::HeapPop() |
| 262 | { |
| 263 | if (HeapEmpty()) { |
| 264 | return NULL; |
| 265 | } |
| 266 | |
| 267 | HeapEntry* top = _list[1]; // 0 reserved. |
| 268 | |
| 269 | _list[1] = _list[_count]; |
| 270 | _list[1]->SetIndex(1); |
| 271 | _list[_count] = 0; |
| 272 | |
| 273 | _count--; |
| 274 | HeapDown(1); |
| 275 | |
| 276 | heap_assert(top->GetIndex() == 1); |
| 277 | top->SetIndex(0); |
| 278 | return top; |
| 279 | } |
| 280 | |
| 281 | inline int HeapList::HeapDelete(HeapEntry* item) |
| 282 | { |