kingMobility.h
Go to the documentation of this file.
/* kingMobility.h
*/
#ifndef _KING_MOBILITY_H
#define _KING_MOBILITY_H
#include "osl/basic_type.h"
#include "osl/container.h"
#include "osl/config.h"
#include <cassert>
#ifndef OSL_USE_SSE
#if !(defined _MSC_VER) && ! defined OSL_NO_SSE
#define OSL_USE_SSE 1
#endif
#endif
namespace osl
{
namespace mobility
{
#if OSL_USE_SSE
typedef long long v2di __attribute__ ((vector_size (16)));
#endif
class KingMobility{
union b128{
CArray<CArray<unsigned char,8>,2> uc16;
unsigned long long ul[2];
#if OSL_USE_SSE
v2di v2;
#endif
} v
#ifdef __GNUC__
__attribute__((aligned(16)))
#endif
;
public:
KingMobility() {
assert(reinterpret_cast<size_t>(this) % 16 == 0);
}
const CArray<unsigned char,8>& operator[](Player p) const{
return v.uc16[p];
}
CArray<unsigned char,8>& operator[](Player p){
return v.uc16[p];
}
KingMobility& operator=(KingMobility const& km){
#if OSL_USE_SSE
v.v2=km.v.v2;
#else
v.uc16=km.v.uc16;
#endif
return *this;
}
bool operator==(KingMobility const& km) const{
#if 0 && OSL_USE_SSE41
return __builtin_ia32_ptestz128(v.v2,km.v.v2);
#else
return ((v.ul[0]^km.v.ul[0])|(v.ul[1]^km.v.ul[1]))==0;
#endif
}
};
}
using mobility::KingMobility;
}
#endif /* _KING_MOBILITY_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::CArray
Definition container.h:20
osl::KingMobility::KingMobility
KingMobility()
Definition kingMobility.h:37
osl::mobility::KingMobility::operator=
KingMobility & operator=(KingMobility const &km)
Definition kingMobility.h:46
osl::mobility::KingMobility::operator==
bool operator==(KingMobility const &km) const
Definition kingMobility.h:54
osl::mobility::KingMobility::operator[]
const CArray< unsigned char, 8 > & operator[](Player p) const
Definition kingMobility.h:40
osl::mobility::KingMobility::operator[]
CArray< unsigned char, 8 > & operator[](Player p)
Definition kingMobility.h:43
osl::mobility::KingMobility::v
union osl::mobility::KingMobility::b128 v
osl::mobility::KingMobility::KingMobility
KingMobility()
Definition kingMobility.h:37
config.h
container.h
osl::mobility::__attribute__
long long v2di __attribute__((vector_size(16)))
Definition kingMobility.h:22
osl
Definition additionalEffect.h:6
osl::Player
Player
Definition basic_type.h:8
osl::KingMobility::b128
Definition kingMobility.h:25
osl::KingMobility::b128::uc16
CArray< CArray< unsigned char, 8 >, 2 > uc16
Definition kingMobility.h:26
osl::KingMobility::b128::ul
unsigned long long ul[2]
Definition kingMobility.h:27
osl::KingMobility::b128::v2
v2di v2
Definition kingMobility.h:29
osl::mobility::KingMobility::b128::uc16
CArray< CArray< unsigned char, 8 >, 2 > uc16
Definition kingMobility.h:26
osl::mobility::KingMobility::b128::ul
unsigned long long ul[2]
Definition kingMobility.h:27
osl::mobility::KingMobility::b128::v2
v2di v2
Definition kingMobility.h:29