This file is indexed.

/usr/include/osl/numEffectState.tcc is in libosl-dev 0.8.0-1.4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* numEffectState.tcc
 */
#ifndef OSL_NUM_EFFECT_STATE_TCC
#define OSL_NUM_EFFECT_STATE_TCC

#include "osl/numEffectState.h"
#include "osl/move_classifier/kingOpenMove.h"
#include "osl/bits/numSimpleEffect.tcc"

template <osl::Player P>
bool osl::NumEffectState::
hasEffectByWithRemove(Square target,Square removed) const
{
  const Piece piece = pieceAt(removed);
  if (! piece.isPiece()) 
    return hasEffectAt<P>(target);
  if (piece.owner() == P) 
  {
    if (hasEffectNotBy(P, piece, target))
      return true;
  }
  else 
  {
    if (hasEffectAt(P, target))
      return true;
  }
  if (! longEffectAt(removed, P).any())
    return false;
  const Direction d = Board_Table.getLongDirection<BLACK>(Offset32(target,removed));
  if (!isLong(d))
    return false;
  const int num=longEffectNumTable()[piece.number()][longToShort(d)];
  return (! Piece::isEmptyNum(num)
	  && pieceOf(num).owner()==P);
}

namespace osl
{
  template <osl::Player P, bool InterestEmpty, Direction Dir>
  struct TestEffectOfMove
  {
    template <class State, class Function>
    static void testShort(const State& s, int mask, Square from, 
			  Function& f) {
      static_assert(! DirectionTraits<Dir>::isLong, "Dir");
      if (! (mask & DirectionTraits<Dir>::mask))
	return;

      const Offset offset = DirectionPlayerTraits<Dir,P>::offset();
      const Square target = from+offset;
      const Piece piece = s.pieceAt(target);
      if (piece.isEdge())
	return;
      if (InterestEmpty || (! piece.isEmpty()))
	f(target);
    }
    template <class State, class Function>
    static void testLong(const State& s, int mask, Square from, 
			 Function& f) {
      static_assert(DirectionTraits<Dir>::isLong, "Dir");
      if (! (mask & DirectionTraits<Dir>::mask))
	return;

      const Offset offset = DirectionPlayerTraits<Dir,P>::offset();

      Square target = from+offset;
      Piece piece = s.pieceAt(target);
      while (piece.isEmpty()) {
	if (InterestEmpty)
	  f(target);		
	target = target+offset;
	piece = s.pieceAt(target);
      }
      if (piece.isPiece()) {
	f(target);
      }
    }
  };
  struct SafeCapture
  {
  public:
    const NumEffectState& state;
    Piece safe_one;
    SafeCapture(const NumEffectState& s) : state(s), safe_one(Piece::EMPTY()) {
    }
    template <Player P>
    void doAction(Piece effect_piece, Square target) {
      if (move_classifier::KingOpenMove<P>::isMember
	  (state, effect_piece.ptype(), effect_piece.square(), target))
	return;
      safe_one = effect_piece;
    }
  };
} // namespace osl

template <osl::Player P, class Function, bool InterestEmpty>
void osl::NumEffectState::
forEachEffectOfPtypeO(Square from, Ptype ptype, Function& f) const
{
  const int mask = Ptype_Table.getMoveMask(ptype);
  TestEffectOfMove<P,InterestEmpty,UL>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,U>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UR>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,L>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,R>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,DL>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,D>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,DR>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UUL>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UUR>::testShort(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_UL>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_U>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_UR>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_L>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_R>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_DL>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_D>::testLong(*this, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_DR>::testLong(*this, mask, from, f);
}

template <class Function, bool InterestEmpty>
void osl::NumEffectState::
forEachEffectOfPtypeO(Square from, PtypeO ptypeo, Function& f) const
{
  const Player P = getOwner(ptypeo);
  if (P == BLACK)
    this->template forEachEffectOfPtypeO<BLACK,Function,InterestEmpty>
      (from, getPtype(ptypeo), f);
  else
    this->template forEachEffectOfPtypeO<WHITE,Function,InterestEmpty>
      (from, getPtype(ptypeo), f);
}


template <osl::Player P>
osl::Piece
osl::NumEffectState::safeCaptureNotByKing(Square target, Piece king) const
{
  assert(king.owner() == P);
  assert(king.ptype() == KING);
  PieceMask ignore = pin(P);
  ignore.set(king.number());
  const Piece piece = findAttackNotBy(P, target, ignore);
  if (piece.isPiece())
    return piece;
  SafeCapture safe_captures(*this);
  this->template forEachEffectNotBy<P>(target, king, safe_captures);
  
  return safe_captures.safe_one;
}

#endif /* OSL_NUM_EFFECT_STATE_TCC */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: