Defines

eurephia_directions.h File Reference

Macro to decide the best search directon on dual-way ring based pointer chains. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define DIR_R   'R'
#define DIR_L   'L'
#define DIRECTION(s, d, l)   (s>d ? ((((l-s)+d) > (s-d)) ? DIR_L : DIR_R) : (((d-s) > ((l-d)+s)) ? DIR_L : DIR_R))

Detailed Description

Macro to decide the best search directon on dual-way ring based pointer chains.

Author:
David Sommerseth <dazo@users.sourceforge.net>
Date:
2008-08-06

Definition in file eurephia_directions.h.


Define Documentation

#define DIR_L   'L'

"Left" direction, where the ID number decreases (previous element)

Definition at line 36 of file eurephia_directions.h.

#define DIR_R   'R'

"Right" direction, where the ID number increases (next element)

Definition at line 35 of file eurephia_directions.h.

#define DIRECTION (   s,
  d,
  l 
)    (s>d ? ((((l-s)+d) > (s-d)) ? DIR_L : DIR_R) : (((d-s) > ((l-d)+s)) ? DIR_L : DIR_R))

This macro finds the quickest way to go from one element to another one in a circular dual-way pointer chain, based on a numeric id of the elements.

Parameters:
s starting point on the chain
d destination point on the chain
l number of elements in the chain
Returns:
Returns DIR_R or DIR_L, depending on what will be the shortest distance.

Definition at line 48 of file eurephia_directions.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines