@@ -55,15 +55,15 @@ constexpr rotation arrows_to_dir_from_mask(unsigned mask)
55
55
fm_assert (false );
56
56
}
57
57
58
- constexpr auto arrows_to_dir_array = map(arrows_to_dir_from_mask, iota_array<uint8_t , 16 >);
59
-
60
58
constexpr auto arrows_to_dir (bool left, bool right, bool up, bool down)
61
59
{
60
+ constexpr auto table = map (arrows_to_dir_from_mask, iota_array<uint8_t , 16 >);
62
61
constexpr uint8_t L = 1 << 3 , R = 1 << 2 , U = 1 << 1 , D = 1 << 0 ;
63
- const uint8_t bits = left*L | right*R | up*U | down*D;
64
62
constexpr uint8_t mask = L|R|U|D;
63
+
64
+ const uint8_t bits = left*L | right*R | up*U | down*D;
65
65
CORRADE_ASSUME ((bits & mask) == bits);
66
- return arrows_to_dir_array .data ()[bits];
66
+ return table .data ()[bits];
67
67
}
68
68
69
69
#if 0
@@ -301,18 +301,18 @@ constexpr rotation dir_from_step_mask(uint8_t val)
301
301
}
302
302
}
303
303
304
- constexpr auto dir_from_step_array = map(dir_from_step_mask, iota_array<uint8_t , 1 << 4 >);
305
-
306
304
constexpr rotation dir_from_step (step_s step)
307
305
{
306
+ constexpr auto table = map (dir_from_step_mask, iota_array<uint8_t , 1 << 4 >);
307
+
308
308
if (step.direction .isZero ()) [[unlikely]]
309
309
return rotation_COUNT;
310
310
311
311
auto x = uint8_t (step.direction .x () + 1 );
312
312
auto y = uint8_t (step.direction .y () + 1 );
313
313
// fm_debug_assert((x & 3) == x && (y & 3) == y);
314
314
auto val = uint8_t (x << 2 | y);
315
- return dir_from_step_array .data ()[val];
315
+ return table .data ()[val];
316
316
}
317
317
318
318
constexpr step_s next_step (point from, point to)
0 commit comments