- kingRing[Us] = attackedBy[Us][KING];
- if (relative_rank(Us, ksq) == RANK_1)
- kingRing[Us] |= shift<Up>(kingRing[Us]);
-
- if (file_of(ksq) == FILE_H)
- kingRing[Us] |= shift<WEST>(kingRing[Us]);
-
- else if (file_of(ksq) == FILE_A)
- kingRing[Us] |= shift<EAST>(kingRing[Us]);
+ Square s = make_square(clamp(file_of(ksq), FILE_B, FILE_G),
+ clamp(rank_of(ksq), RANK_2, RANK_7));
+ kingRing[Us] = PseudoAttacks[KING][s] | s;