77 for (i = 0; i < 2; i++) {
113 newRoot = oldRoot->
child[d];
114 oldMiddle = newRoot->
child[!d];
116 oldRoot->
child[d] = oldMiddle;
117 newRoot->
child[!d] = oldRoot;
134 for (d = 0; d < 2; d++) {
171 "AVL tree out of memory.\nIncrease avl-size beyond %d\n",
188 if (key->
event_id == (*t)->key->event_id) {
190 if (key->
send_pe == (*t)->key->send_pe) {
229 tw_event *event_with_lowest_ts = NULL;
236 event_with_lowest_ts = oldroot->
key;
237 *t = oldroot->
child[1];
246 return event_with_lowest_ts;
263 if (key->
event_id == (*t)->key->event_id) {
265 if (key->
send_pe == (*t)->key->send_pe) {
307 "AVL tree out of memory.\nIncrease avl-size beyond %d\n",
void avlInsert(AvlTree *t, tw_event *key)
int avlSearch(AvlTree t, tw_event *key)
void avlPrintKeys(AvlTree t)
tw_eventid event_id
Unique id assigned by src_lp->pe if remote.
void tw_error(const char *file, int line, const char *fmt,...) NORETURN
tw_event * avlDeleteMin(AvlTree *t)
tw_stime recv_ts
Actual time to be received.
tw_event * avlDelete(AvlTree *t, tw_event *key)
Holds the entire PE state.
int avlGetHeight(AvlTree t)
static void avlRebalance(AvlTree *t)
static void avlFixHeight(AvlTree t)
#define TW_STIME_CMP(x, y)
uint32_t g_tw_avl_node_count
void avlSanityCheck(AvlTree root)
void avlDestroy(AvlTree t)
static void avlRotate(AvlTree *root, int d)
void tw_printf(const char *file, int line, const char *fmt,...)
struct avlNode * child[2]