Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / xbt / heap_private.h
1 /* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
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 <float.h>
10 #include <xbt/dynar.h>
11 #include <xbt/heap.h>
12
13 typedef struct xbt_heap_item {
14   void *content;
15   double key;
16 } s_xbt_heap_item_t, *xbt_heap_item_t;
17
18 typedef struct xbt_heap {
19   int size;
20   int count;
21   s_xbt_heap_item_t* items; /* array of structs */
22   void_f_pvoid_t free;
23   void (*update_callback) (void *, int);
24 } s_xbt_heap_t;
25
26 #define PARENT(i)  (i >> 1)
27 #define LEFT(i)    (i << 1)
28 #define RIGHT(i)   ((i << 1) + 1)
29
30 #define KEY(H,i)     ((H->items)[i]).key
31 #define CONTENT(H,i) ((H->items)[i]).content
32
33 #define MIN_KEY_VALUE -DBL_MAX
34
35 #endif /* XBT_HEAP_PRIVATE_H */