Chess Engine
A Chess Engine project written in C++.
Loading...
Searching...
No Matches
utils.hpp
1#pragma once
2
3#include <cmath>
4
5#include "bitboard.hpp"
6
7constexpr float eucledianDistance(const std::pair<float, float>& a, const std::pair<float, float>& b) {
8 return std::sqrt(((a.first - b.first) * (a.first - b.first)) + ((a.second - b.second) * (a.second - b.second)));
9}
10
11constexpr Square lsb(const Bitboard& x) { return static_cast<Square>(__builtin_ctzll(x)); }
12constexpr Square popLSB(Bitboard& x) {
13 Square i = lsb(x);
14 x &= x - 1;
15 return i;
16}
17constexpr uint8_t popCount(Bitboard x) { return __builtin_popcountll(x); }
Definition bitboard.hpp:9
Definition navigation.hpp:118