/usr/include/osl/mobility/mobilityTable.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 | /* mobilityTable.h
*/
#ifndef _MOBILITY_TABLE_H
#define _MOBILITY_TABLE_H
#include "osl/direction.h"
#include "osl/misc/carray.h"
#include "osl/state/simpleState.h"
#include <cassert>
#include <iosfwd>
namespace osl
{
namespace mobility
{
union V4 {
unsigned int lv;
CArray<unsigned char,4> uc;
}
#ifdef __GNUC__
__attribute__((aligned(4)))
#endif
;
/**
* 駒毎に指定の方向の利きを持つ最後のSquare.
* 自分の駒への利きも含む
* EDGEまでいく
* 方向は「黒」から見た方向に固定
* そもそもそちらに利きがない場合やSTANDにある場合は0
*/
class MobilityContent
{
V4 v;
public:
MobilityContent() {
clear();
}
void clear(){
v.lv=0u;
}
const Square get(Direction d) const{
return Square::makeDirect(v.uc[((unsigned int)d)>>1]);
}
void set(Direction d,Square pos){
v.uc[((unsigned int)d)>>1]=static_cast<unsigned char>(pos.uintValue());
}
};
std::ostream& operator<<(std::ostream& os,MobilityContent const& mc);
/**
* 駒番号からMobilityContentを得る
*/
class MobilityTable
{
CArray<MobilityContent,8> table
#ifdef __GNUC__
__attribute__((aligned(16)))
#endif
;
public:
MobilityTable(){}
MobilityTable(SimpleState const& state);
void set(Direction d,int num,Square pos){
assert(0<=(int)d && (int)d<=7);
return table[num-32].set(d,pos);
}
const Square get(Direction d,int num) const{
assert(0<=(int)d && (int)d<=7);
return table[num-32].get(d);
}
friend bool operator==(const MobilityTable& mt1,const MobilityTable& mt2);
};
std::ostream& operator<<(std::ostream& os,MobilityTable const& mt);
bool operator==(const MobilityTable&,const MobilityTable&);
}
using mobility::MobilityTable;
}
#endif /* _MOBILITY_TABLE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|