This file is indexed.

/usr/include/osl/container/pieceMask.h is in libosl-dev 0.6.0-3.

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
#ifndef _PIECE_MASK_H
#define _PIECE_MASK_H
#include "osl/config.h"

#include "osl/misc/mask.h"
#include "osl/ptypeTraits.h"
#if OSL_WORDSIZE == 64
#  include "osl/container/pieceMask64.h"
#elif OSL_WORDSIZE == 32
#  include "osl/container/pieceMask32.h"
#endif

#include <iosfwd>

namespace osl
{
  namespace container
  {
#if OSL_WORDSIZE == 64
  typedef PieceMask64 PieceMaskBase;
#elif OSL_WORDSIZE == 32
  typedef PieceMask32 PieceMaskBase;
#endif

  /**
   * 駒番号のビットセット.
   * 64bitのMask64を一つもしくは,32bitのMask32を2枚で表現する.
   * 各メソッドの変数名は num は駒番号に,
   * index はマスクのID(0-1)に用いられている.
   */
  class PieceMask : public PieceMaskBase
  {
  public:
    PieceMask() {}
    PieceMask(const PieceMaskBase& base) : PieceMaskBase(base) {}
    static const mask_t numToMask(int num) { 
      return mask_t::makeDirect(1) << PieceMask::numToOffset(num); 
    }
    void setMask(int index,mask_t val) {
      mutableMask(index)=val;
    }
  private:
    mask_t& mutableMaskNum(int num) {
      return mutableMask(numToIndex(num));
    }
    const mask_t getMaskNum(int num) const {
      return getMask(numToIndex(num));
    }
  public:
    void xorMask(int index,mask_t val) {
      mutableMask(index)^=val;
    }
    void orMask(int index,mask_t val) {
      mutableMask(index)|=val;
    }
    bool test(int num) const {
      return (getMaskNum(num)&numToMask(num)).any();
    }
    void set(int num) {
      mutableMaskNum(num)|=numToMask(num);
    }
    void flip(int num) {
      mutableMaskNum(num)^=numToMask(num);
    }
    void reset(int num) {
      mutableMaskNum(num)&= ~numToMask(num);
    }
    bool any() const { return ! none(); }

    const mask_t getMask(int num) const { return PieceMaskBase::getMask(num); }
    /** unpromote(PTYPE) の駒のbit を*含む*mask_tを取り出す */
    template <Ptype PTYPE>
    const mask_t getMask() const { return getMask(PtypeFuns<PTYPE>::indexNum); }
    
    /** unpromote(PTYPE) の駒のbit だけ取り出す */
    template <Ptype PTYPE>
    const mask_t selectBit() const 
    {
      mask_t mask = getMask<PTYPE>();
      mask &= mask_t::makeDirect(PtypeFuns<PtypeFuns<PTYPE>::basicType>::indexMask);
      return mask;
    }
    /** unpromote(PTYPE) の駒のbit を消す */
    template <Ptype PTYPE>
    void clearBit()
    {
      mask_t& mask = mutableMask(PtypeFuns<PTYPE>::indexNum);
      mask &= ~mask_t::makeDirect(PtypeFuns<PtypeFuns<PTYPE>::basicType>::indexMask);
    }
    /** unpromote(PTYPE) の駒のbit を立てる */
    template <Ptype PTYPE>
    void setBit()
    {
      mask_t& mask = mutableMask(PtypeFuns<PTYPE>::indexNum);
      mask |= mask_t::makeDirect(PtypeFuns<PtypeFuns<PTYPE>::basicType>::indexMask);
    }
  };

  // TODO: PieceMask32 と PieceMask64 に分離
  inline const PieceMask operator&(const PieceMask &m1, const PieceMask &m2) {
#if OSL_WORDSIZE == 64
    return PieceMask64(m1.getMask(0)&m2.getMask(0));
#elif OSL_WORDSIZE == 32
    return PieceMask32(m1.getMask(0)&m2.getMask(0),
		       m1.getMask(1)&m2.getMask(1));
#endif
  }

  // TODO: PieceMask32 と PieceMask64 に分離
  inline const PieceMask operator|(const PieceMask &m1, const PieceMask &m2) {
#if OSL_WORDSIZE == 64
    return PieceMask64(m1.getMask(0)|m2.getMask(0));
#elif OSL_WORDSIZE == 32
    return PieceMask32(m1.getMask(0)|m2.getMask(0),
		       m1.getMask(1)|m2.getMask(1));
#endif
  }
  // TODO: PieceMask32 と PieceMask64 に分離
  inline const PieceMask operator~(const PieceMask &m1) {
#if OSL_WORDSIZE == 64
    return PieceMask64(~m1.getMask(0));
#elif OSL_WORDSIZE == 32
    return PieceMask32(~m1.getMask(0),~m1.getMask(1));
#endif
  }

  inline bool operator==(const PieceMask &m1, const PieceMask &m2){
    return m1.getMask(0)==m2.getMask(0) && m1.getMask(1)==m2.getMask(1);
  }
  inline bool operator!=(const PieceMask &m1, const PieceMask &m2)
  {
    return ! (m1 == m2);
  }
  std::ostream& operator<<(std::ostream& os,PieceMask const& pieceMask);
  } // namespace container
  using container::PieceMask;
} // namespace osl


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