diff --git a/Bitboard.h b/Bitboard.h index 5adcac5..0b4cc8e 100644 --- a/Bitboard.h +++ b/Bitboard.h @@ -1,6 +1,7 @@ #ifndef LIBCHESS_BITBOARD_H #define LIBCHESS_BITBOARD_H +#include #include #include #include @@ -97,13 +98,13 @@ class Bitboard { return *this; } constexpr int popcount() const { - return __builtin_popcountll(value_); + return std::popcount(value_); } constexpr Square forward_bitscan() const { - return Square{__builtin_ctzll(value_)}; + return Square{std::countr_zero(value_)}; } constexpr Square reverse_bitscan() const { - return Square{63 - __builtin_clzll(value_)}; + return Square{63 - std::countl_zero(value_)}; } constexpr void forward_popbit() { value_ &= value_ - 1; diff --git a/CMakeLists.txt b/CMakeLists.txt index e218d18..bcfd4e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.12) project(libchess) # Flags -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic") set(CMAKE_CXX_FLAGS_DEBUG "-g -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")