stellar

Stellar - UCI Chess engine written in C++20
git clone git://git.dimitrijedobrota.com/stellar.git
Log | Files | Refs | README | LICENSE

bitboard.hpp (837B)


      1 #ifndef STELLAR_BITBOARD_H
      2 #define STELLAR_BITBOARD_H
      3 
      4 #include "utils.hpp"
      5 
      6 namespace bitboard {
      7 
      8 void print(U64 bitboard);
      9 
     10 inline constexpr const U64 notAFile = C64(0xfefefefefefefefe);
     11 inline constexpr const U64 notHFile = C64(0x7f7f7f7f7f7f7f7f);
     12 
     13 typedef U64 (*direction_f)(U64);
     14 inline constexpr U64 soutOne(U64 b) { return b >> 8; }
     15 inline constexpr U64 nortOne(U64 b) { return b << 8; }
     16 inline constexpr U64 eastOne(U64 b) { return (b & notHFile) << 1; }
     17 inline constexpr U64 westOne(U64 b) { return (b & notAFile) >> 1; }
     18 inline constexpr U64 soEaOne(U64 b) { return (b & notHFile) >> 7; }
     19 inline constexpr U64 soWeOne(U64 b) { return (b & notAFile) >> 9; }
     20 inline constexpr U64 noEaOne(U64 b) { return (b & notHFile) << 9; }
     21 inline constexpr U64 noWeOne(U64 b) { return (b & notAFile) << 7; }
     22 
     23 } // namespace bitboard
     24 
     25 #endif