Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
[simgrid.git] / src / xbt / heap_private.h
1 /* Authors: Arnaud Legrand                                                  */
2
3 /* This program is free software; you can redistribute it and/or modify it
4    under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef _XBT_HEAP_PRIVATE_H
7 #define _XBT_HEAP_PRIVATE_H
8
9 #include <stdlib.h>
10 #include "xbt_heap.h"
11
12 typedef struct xbt_heapItem {
13   void *content;
14   xbt_heap_float_t key;
15 } s_xbt_heapItem_t, *xbt_heapItem_t;
16
17 typedef struct xbt_heap {
18   int size;
19   int count;
20   xbt_heapItem_t items;
21   void_f_pvoid_t *free;
22 } s_xbt_heap_t;
23
24 #define PARENT(i)  i/2
25 #define LEFT(i)    2*i
26 #define RIGHT(i)   2*i+1
27
28 #define KEY(H,i)     ((H->items)[i]).key
29 #define CONTENT(H,i) ((H->items)[i]).content
30
31 void xbt_heap_maxHeapify(xbt_heap_t H);
32 void xbt_heap_increaseKey(xbt_heap_t H, int i);
33
34 #endif                          /* _XBT_HEAP_PRIVATE_H */