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
7
constexpr
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
11
constexpr
Square
lsb(
const
Bitboard
& x) {
return
static_cast<
Square
>
(__builtin_ctzll(x)); }
12
constexpr
Square
popLSB(
Bitboard
& x) {
13
Square
i = lsb(x);
14
x &= x - 1;
15
return
i;
16
}
17
constexpr
uint8_t popCount(
Bitboard
x) {
return
__builtin_popcountll(x); }
Bitboard
Definition
bitboard.hpp:9
Square
Definition
navigation.hpp:118
app
utils
utils.hpp
Generated by
1.14.0