1
0
Fork 0

const -> static

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-03 15:59:44 +01:00
parent 6c706fae26
commit 2d3ae075d9

View file

@ -109,7 +109,7 @@ macro_rules! by_direction {
}}; }};
} }
const RAYS: BySquare<ByDirection<Bitboard>> = by_square!( static RAYS: BySquare<ByDirection<Bitboard>> = by_square!(
square, square,
ByDirection([Bitboard(0); 8]), ByDirection([Bitboard(0); 8]),
by_direction!(direction, { by_direction!(direction, {
@ -123,7 +123,7 @@ const RAYS: BySquare<ByDirection<Bitboard>> = by_square!(
}) })
); );
const LINES: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0); 64]), { static LINES: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0); 64]), {
by_square!(b, Bitboard(0), { by_square!(b, Bitboard(0), {
let mut res = Bitboard(0); let mut res = Bitboard(0);
loop_all_directions!(d, { loop_all_directions!(d, {
@ -136,7 +136,7 @@ const LINES: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0);
}) })
}); });
const SEGMENTS: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0); 64]), { static SEGMENTS: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(0); 64]), {
by_square!(b, Bitboard(0), { by_square!(b, Bitboard(0), {
let mut res = 0; let mut res = 0;
loop_all_directions!(d, { loop_all_directions!(d, {
@ -149,7 +149,7 @@ const SEGMENTS: BySquare<BySquare<Bitboard>> = by_square!(a, BySquare([Bitboard(
}) })
}); });
const KING_MOVES: BySquare<Bitboard> = by_square!(sq, Bitboard(0), { static KING_MOVES: BySquare<Bitboard> = by_square!(sq, Bitboard(0), {
let mut res = 0; let mut res = 0;
loop_all_directions!(d, { loop_all_directions!(d, {
if let Some(x) = sq.trans(d) { if let Some(x) = sq.trans(d) {
@ -159,7 +159,7 @@ const KING_MOVES: BySquare<Bitboard> = by_square!(sq, Bitboard(0), {
Bitboard(res) Bitboard(res)
}); });
const KNIGHT_MOVES: BySquare<Bitboard> = by_square!(s, Bitboard(0), { static KNIGHT_MOVES: BySquare<Bitboard> = by_square!(s, Bitboard(0), {
let mut res = Bitboard(0); let mut res = Bitboard(0);
if let Some(s) = s.trans(Direction::North) { if let Some(s) = s.trans(Direction::North) {
if let Some(s) = s.trans(Direction::NorthEast) { if let Some(s) = s.trans(Direction::NorthEast) {
@ -196,7 +196,7 @@ const KNIGHT_MOVES: BySquare<Bitboard> = by_square!(s, Bitboard(0), {
res res
}); });
const PAWN_ATTACKS: ByColor<BySquare<Bitboard>> = { static PAWN_ATTACKS: ByColor<BySquare<Bitboard>> = {
by_color!(color, { by_color!(color, {
let direction = match color { let direction = match color {
Color::White => Direction::North, Color::White => Direction::North,
@ -278,7 +278,7 @@ const fn rook_premask(square: Square) -> Bitboard {
Bitboard(premask) Bitboard(premask)
} }
const MAGICS: (BySquare<Magic>, BySquare<Magic>, usize) = { static MAGICS: (BySquare<Magic>, BySquare<Magic>, usize) = {
let mut len: usize = 0; let mut len: usize = 0;
( (
by_square!( by_square!(
@ -353,7 +353,7 @@ struct Magic {
} }
#[allow(long_running_const_eval)] #[allow(long_running_const_eval)]
const MAGIC_TABLE: [Bitboard; MAGICS.2] = { static MAGIC_TABLE: [Bitboard; MAGICS.2] = {
let mut table = [Bitboard(0); MAGICS.2]; let mut table = [Bitboard(0); MAGICS.2];
by_square!(square, (), { by_square!(square, (), {
let Magic { let Magic {