/usr/include/osl/bits/squareCompressor.h 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 | /* squareCompressor.h
*/
#ifndef OSL_POSITIONCOMPRESSOR_H
#define OSL_POSITIONCOMPRESSOR_H
#include "osl/basic_type.h"
#include "osl/container.h"
namespace osl
{
/**
* Square を [0..81] に圧縮する
* 0: 駒台,1..81 盤上
*/
struct SquareCompressor
{
private:
/** 本当はconst にしたいけど初期化が手間なので後回し */
static CArray<signed char, Square::SIZE> positionToIndex;
public:
class Initializer;
friend class Initializer;
static int compress(Square pos)
{
const int result = positionToIndex[pos.index()];
assert(result >= 0);
return result;
}
static Square
#ifdef __GNUC__
__attribute__ ((noinline))
#endif
melt(int index)
{
assert(0 <= index);
assert(index < 82);
if (index == 0)
return Square::STAND();
--index;
return Square(index/9+1, index%9+1);
}
};
} // namespace osl
#endif /* OSL_POSITIONCOMPRESSOR_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|