| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -std=c++11" } */ |
| 3 |
#include <array> |
| 4 |
|
| 5 |
static constexpr int NBR_SHIFT = 4; |
| 6 |
|
| 7 |
static constexpr int MAXBOARDSIZE = 25; |
| 8 |
|
| 9 |
static constexpr int MAXSQ = ((MAXBOARDSIZE + 2) * (MAXBOARDSIZE + 2)); |
| 10 |
|
| 11 |
enum square_t : char { |
| 12 |
BLACK = 0, WHITE = 1, EMPTY = 2, INVAL = 3 |
| 13 |
}; |
| 14 |
|
| 15 |
const std::array<int, 2> s_eyemask = { |
| 16 |
4 * (1 << (NBR_SHIFT * BLACK)), |
| 17 |
4 * (1 << (NBR_SHIFT * WHITE)) |
| 18 |
}; |
| 19 |
|
| 20 |
/* counts of neighboring stones */ |
| 21 |
std::array<unsigned short, MAXSQ> m_neighbours; |
| 22 |
|
| 23 |
int is_eye(const int color, const int i) { |
| 24 |
/* check for 4 neighbors of the same color */ |
| 25 |
int ownsurrounded = (m_neighbours[i] & s_eyemask[color]); |
| 26 |
|
| 27 |
return ownsurrounded; |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-assembler "s_eyemask" } } */ |