X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fdirection.hh;h=6fe5efcc19c8f446ebd16e63584dd146f056c8da;hb=bb8a0a5387af94dd2702877256334b160575a730;hp=0ba482fe2c580ff9ac73926879c075484439decc;hpb=1c846b2c2348b4e0ca4a3c2e8fb267047ba2d203;p=lilypond.git diff --git a/flower/include/direction.hh b/flower/include/direction.hh index 0ba482fe2c..6fe5efcc19 100644 --- a/flower/include/direction.hh +++ b/flower/include/direction.hh @@ -23,30 +23,30 @@ #include "axis.hh" enum Direction - { - UP = 1, - DOWN=-1, - LEFT=-1, - RIGHT = 1, - MIN=-1, - MAX = 1, - CENTER = 0, - SMALLER=-1, - BIGGER = 1, - START = -1, - STOP = 1, - - /* - This is necessary to safely write loops, - since - - dir <= RIGHT - - is otherwise transformed into true unconditionally. - */ - DIRECTION_LIMIT = 2, - DIRECTION_NEG_LIMIT = -2, - }; +{ + UP = 1, + DOWN = -1, + LEFT = -1, + RIGHT = 1, + MIN = -1, + MAX = 1, + CENTER = 0, + SMALLER = -1, + BIGGER = 1, + START = -1, + STOP = 1, + + /* + This is necessary to safely write loops, + since + + dir <= RIGHT + + is otherwise transformed into true unconditionally. + */ + DIRECTION_LIMIT = 2, + DIRECTION_NEG_LIMIT = -2, +}; inline Direction other_dir (Direction const d) @@ -75,7 +75,13 @@ flip (Direction *i) if d > 0: the max operator if d < 0: the min operator */ -template T minmax (Direction d, T, T); +template T minmax (Direction d, T a, T b) +{ + if (d == UP) + return max (a, b); + else + return min (a, b); +} // String direction_string (Direction, Axis);