equal
deleted
inserted
replaced
22 INVALID_DIR = 0xFF, |
22 INVALID_DIR = 0xFF, |
23 }; |
23 }; |
24 |
24 |
25 /** Define basic enum properties */ |
25 /** Define basic enum properties */ |
26 template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {}; |
26 template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {}; |
27 typedef TinyEnumT<Direction> DirectionByte; |
27 typedef TinyEnumT<Direction> DirectionByte; //typedefing-enumification of Direction |
28 |
28 |
29 static inline Direction ReverseDir(Direction d) |
29 static inline Direction ReverseDir(Direction d) |
30 { |
30 { |
31 return (Direction)(4 ^ d); |
31 return (Direction)(4 ^ d); |
32 } |
32 } |
71 |
71 |
72 DECLARE_POSTFIX_INCREMENT(DiagDirection); |
72 DECLARE_POSTFIX_INCREMENT(DiagDirection); |
73 |
73 |
74 /** Define basic enum properties */ |
74 /** Define basic enum properties */ |
75 template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR> {}; |
75 template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR> {}; |
76 typedef TinyEnumT<DiagDirection> DiagDirectionByte; |
76 typedef TinyEnumT<DiagDirection> DiagDirectionByte; //typedefing-enumification of DiagDirection |
77 |
77 |
78 static inline DiagDirection ReverseDiagDir(DiagDirection d) |
78 static inline DiagDirection ReverseDiagDir(DiagDirection d) |
79 { |
79 { |
80 return (DiagDirection)(2 ^ d); |
80 return (DiagDirection)(2 ^ d); |
81 } |
81 } |
135 return (DiagDirection)(2 - a); |
135 return (DiagDirection)(2 - a); |
136 } |
136 } |
137 |
137 |
138 /** |
138 /** |
139 * Convert an axis and a flag for north/south into a DiagDirection |
139 * Convert an axis and a flag for north/south into a DiagDirection |
|
140 * @param xy axis to convert |
140 * @param ns north -> 0, south -> 1 |
141 * @param ns north -> 0, south -> 1 |
|
142 * @return the desired DiagDirection |
141 */ |
143 */ |
142 static inline DiagDirection XYNSToDiagDir(Axis xy, uint ns) |
144 static inline DiagDirection XYNSToDiagDir(Axis xy, uint ns) |
143 { |
145 { |
144 return (DiagDirection)(xy * 3 ^ ns * 2); |
146 return (DiagDirection)(xy * 3 ^ ns * 2); |
145 } |
147 } |