1
0
Fork 0

Retire FORCE_INLINE

gcc_bug
root 2015-01-10 12:10:49 +00:00
parent 460e64667a
commit d399001462
3 changed files with 10 additions and 18 deletions

View File

@ -69,7 +69,7 @@ namespace {
// bsf_index() returns the index into BSFTable[] to look up the bitscan. Uses
// Matt Taylor's folding for 32 bit case, extended to 64 bit by Kim Walisch.
FORCE_INLINE unsigned bsf_index(Bitboard b) {
inline unsigned bsf_index(Bitboard b) {
b ^= b - 1;
return Is64Bit ? (b * DeBruijn64) >> 58
: ((unsigned(b) ^ unsigned(b >> 32)) * DeBruijn32) >> 26;

View File

@ -231,7 +231,7 @@ template<> inline int distance<Rank>(Square x, Square y) { return distance(rank_
/// piece of type Pt (bishop or rook) placed on 's'. The helper magic_index()
/// looks up the index using the 'magic bitboards' approach.
template<PieceType Pt>
FORCE_INLINE unsigned magic_index(Square s, Bitboard occupied) {
inline unsigned magic_index(Square s, Bitboard occupied) {
Bitboard* const Masks = Pt == ROOK ? RookMasks : BishopMasks;
Bitboard* const Magics = Pt == ROOK ? RookMagics : BishopMagics;
@ -265,13 +265,13 @@ inline Bitboard attacks_bb(Piece pc, Square s, Bitboard occupied) {
# if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
FORCE_INLINE Square lsb(Bitboard b) {
inline Square lsb(Bitboard b) {
unsigned long idx;
_BitScanForward64(&idx, b);
return (Square) idx;
}
FORCE_INLINE Square msb(Bitboard b) {
inline Square msb(Bitboard b) {
unsigned long idx;
_BitScanReverse64(&idx, b);
return (Square) idx;
@ -279,28 +279,28 @@ FORCE_INLINE Square msb(Bitboard b) {
# elif defined(__arm__)
FORCE_INLINE int lsb32(uint32_t v) {
inline int lsb32(uint32_t v) {
__asm__("rbit %0, %1" : "=r"(v) : "r"(v));
return __builtin_clz(v);
}
FORCE_INLINE Square msb(Bitboard b) {
inline Square msb(Bitboard b) {
return (Square) (63 - __builtin_clzll(b));
}
FORCE_INLINE Square lsb(Bitboard b) {
inline Square lsb(Bitboard b) {
return (Square) (uint32_t(b) ? lsb32(uint32_t(b)) : 32 + lsb32(uint32_t(b >> 32)));
}
# else // Assumed gcc or compatible compiler
FORCE_INLINE Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen
inline Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen
Bitboard idx;
__asm__("bsfq %1, %0": "=r"(idx): "rm"(b) );
return (Square) idx;
}
FORCE_INLINE Square msb(Bitboard b) {
inline Square msb(Bitboard b) {
Bitboard idx;
__asm__("bsrq %1, %0": "=r"(idx): "rm"(b) );
return (Square) idx;
@ -318,7 +318,7 @@ Square msb(Bitboard b);
/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard
FORCE_INLINE Square pop_lsb(Bitboard* b) {
inline Square pop_lsb(Bitboard* b) {
const Square s = lsb(*b);
*b &= *b - 1;
return s;

View File

@ -13,14 +13,6 @@ const bool HasPopCnt = true;
#define CACHE_LINE_SIZE 64
#ifdef _MSC_VER
# define FORCE_INLINE __forceinline
#elif defined(__GNUC__)
# define FORCE_INLINE inline __attribute__((always_inline))
#else
# define FORCE_INLINE inline
#endif
#ifdef IS_64BIT
const bool Is64Bit = true;
#else