BRL-CAD
rb_rotate.c File Reference
#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "bu/rb.h"
#include "./rb_internals.h"
Include dependency graph for rb_rotate.c:

Go to the source code of this file.

Functions

void rb_rot_left (struct bu_rb_node *x, int order)
 
void rb_rot_right (struct bu_rb_node *y, int order)
 

Detailed Description

Routines to perform rotations on a red-black tree

Definition in file rb_rotate.c.

Function Documentation

void rb_rot_left ( struct bu_rb_node x,
int  order 
)

Perform left rotation on a red-black tree

This function has two parameters: the node about which to rotate and the order to be rotated. rb_rot_left() is an implementation of the routine called LEFT-ROTATE on p. 266 of Cormen et al., with modification on p. 285.

Definition at line 32 of file rb_rotate.c.

References BU_CKMAG, bu_log(), BU_RB_DEBUG_OS, BU_RB_DEBUG_ROTATE, BU_RB_NODE_MAGIC, RB_CKORDER, RB_LEFT_CHILD, RB_NULL, RB_PARENT, RB_RIGHT_CHILD, RB_ROOT, RB_SIZE, bu_rb_node::rbn_tree, bu_rb_tree::rbt_debug, and UNLIKELY.

Here is the call graph for this function:

void rb_rot_right ( struct bu_rb_node y,
int  order 
)

Perform right rotation on a red-black tree

This function has two parameters: the node about which to rotate and the order to be rotated. rb_rot_right() is hacked from rb_rot_left() above.

Definition at line 73 of file rb_rotate.c.

References BU_CKMAG, bu_log(), BU_RB_DEBUG_OS, BU_RB_DEBUG_ROTATE, BU_RB_NODE_MAGIC, RB_CKORDER, RB_LEFT_CHILD, RB_NULL, RB_PARENT, RB_RIGHT_CHILD, RB_ROOT, RB_SIZE, bu_rb_node::rbn_tree, bu_rb_tree::rbt_debug, and UNLIKELY.

Here is the call graph for this function: