/usr/include/osl/effect/boardBitEffect.h is in libosl-dev 0.6.0-3.1.
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 | /* boardBitEffect.h
*/
#ifndef _BOARD_BIT_EFFECT_H
#define _BOARD_BIT_EFFECT_H
#include "osl/applyDoUndoXMove.h"
#include "osl/boardBitMask.h"
namespace osl
{
namespace effect
{
/**
* 91マスの盤上の駒の有無を91ビットで表現するState.
* 2つの位置の間がすべて空白かを高速に判定可能
* 64bitプロセッサあるいはSSE2命令があるプロセッサで特に有効
* 現在は使われていない
*/
template<class State>
class BoardBitEffect : public State{
typedef BoardBitEffect<State> BoardBitState;
friend class ApplyDoUndoSimpleMove<BLACK,BoardBitState>;
friend class ApplyDoUndoCaptureMove<BLACK,BoardBitState>;
friend class ApplyDoUndoDropMove<BLACK,BoardBitState>;
friend class ApplyDoUndoSimpleMove<WHITE,BoardBitState>;
friend class ApplyDoUndoCaptureMove<WHITE,BoardBitState>;
friend class ApplyDoUndoDropMove<WHITE,BoardBitState>;
public:
BoardBitMask emptyMask;
typedef BoardBitEffect effect_state_t;
template<typename OrigState>
explicit BoardBitEffect(OrigState& st) :State(st),emptyMask(st){
}
/**
* 引数なしのコンストラクタも一応定義しておく
*/
explicit BoardBitEffect() {
}
};
template<Player P,typename BaseState>
struct ApplyDoUndoSimpleMove<P,BoardBitEffect<BaseState> >
{
typedef BoardBitEffect<BaseState> state_t;
template <typename F>
static void doUndoSimpleMove(state_t& s,
Square from, Square to, int promoteMask,F& func){
BoardBitMask oldMask=s.emptyMask;
s.emptyMask^=(boardBitMaskTable.getMask(from)^boardBitMaskTable.getMask(to));
ApplyDoUndoSimpleMove<P,BaseState>::doUndoSimpleMove(s,from,to,promoteMask,func);
s.emptyMask=oldMask;
}
};
template<Player P,typename BaseState>
struct ApplyDoUndoDropMove<P,BoardBitEffect<BaseState> >
{
typedef BoardBitEffect<BaseState> state_t;
template <typename F>
static void doUndoDropMove(state_t& s,
Square to, Ptype ptype,F& func){
BoardBitMask oldMask=s.emptyMask;
s.emptyMask^=boardBitMaskTable.getMask(to);
ApplyDoUndoDropMove<P,BaseState>::doUndoDropMove(s,to,ptype,func);
s.emptyMask=oldMask;
}
};
template<Player P,typename BaseState>
struct ApplyDoUndoCaptureMove<P,BoardBitEffect<BaseState> >
{
typedef BoardBitEffect<BaseState> state_t;
template <typename F>
static void doUndoCaptureMove(state_t& s,
Square from,Square to, Piece p1, int promoteMask,F& func){
BoardBitMask oldMask=s.emptyMask;
s.emptyMask^=boardBitMaskTable.getMask(from);
ApplyDoUndoCaptureMove<P,BaseState>::doUndoCaptureMove(s,from,to,p1,promoteMask,func);
s.emptyMask=oldMask;
}
};
} // namespace effect
} // namespace osl
#endif // _BOARD_BIT_EFFECT_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|