edition 2021 -> 2024
This commit is contained in:
parent
0cc2402991
commit
c0e915f1b4
4 changed files with 19 additions and 15 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "eschac"
|
name = "eschac"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = ["Paul-Nicolas Madelaine <pnm@pnm.tf>"]
|
authors = ["Paul-Nicolas Madelaine <pnm@pnm.tf>"]
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
description = "computing chess moves"
|
description = "computing chess moves"
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ impl Bitboard {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn pop(&mut self) -> Option<Square> {
|
pub const fn pop(&mut self) -> Option<Square> {
|
||||||
let Self(ref mut mask) = self;
|
let mask = &mut self.0;
|
||||||
let square = match mask {
|
let square = match mask {
|
||||||
0 => None,
|
0 => None,
|
||||||
_ => Some(unsafe { Square::new_unchecked(mask.trailing_zeros() as u8) }),
|
_ => Some(unsafe { Square::new_unchecked(mask.trailing_zeros() as u8) }),
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ impl File {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
||||||
debug_assert!(index < 8);
|
debug_assert!(index < 8);
|
||||||
std::mem::transmute(index)
|
unsafe { std::mem::transmute(index) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -216,7 +216,7 @@ impl Rank {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
||||||
debug_assert!(index < 8);
|
debug_assert!(index < 8);
|
||||||
std::mem::transmute(index)
|
unsafe { std::mem::transmute(index) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -315,7 +315,7 @@ impl Square {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
||||||
debug_assert!(index < 64);
|
debug_assert!(index < 64);
|
||||||
std::mem::transmute(index)
|
unsafe { std::mem::transmute(index) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -673,7 +673,7 @@ impl Direction {
|
||||||
#[inline]
|
#[inline]
|
||||||
const unsafe fn transmute(value: u8) -> Self {
|
const unsafe fn transmute(value: u8) -> Self {
|
||||||
debug_assert!(value < 8);
|
debug_assert!(value < 8);
|
||||||
std::mem::transmute(value)
|
unsafe { std::mem::transmute(value) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -435,16 +435,20 @@ unsafe fn magic_aux(shr: u8, magic: Magic, blockers: Bitboard) -> Bitboard {
|
||||||
factor,
|
factor,
|
||||||
offset,
|
offset,
|
||||||
} = magic;
|
} = magic;
|
||||||
debug_assert!(MAGIC_TABLE
|
debug_assert!(
|
||||||
.get(
|
MAGIC_TABLE
|
||||||
(hash(shr, factor, blockers | premask) as isize)
|
.get(
|
||||||
.checked_add(offset)
|
(hash(shr, factor, blockers | premask) as isize)
|
||||||
.unwrap() as usize
|
.checked_add(offset)
|
||||||
|
.unwrap() as usize
|
||||||
|
)
|
||||||
|
.is_some()
|
||||||
|
);
|
||||||
|
unsafe {
|
||||||
|
*MAGIC_TABLE.get_unchecked(
|
||||||
|
((hash(shr, factor, blockers | premask) as isize).unchecked_add(offset)) as usize,
|
||||||
)
|
)
|
||||||
.is_some());
|
}
|
||||||
*MAGIC_TABLE.get_unchecked(
|
|
||||||
((hash(shr, factor, blockers | premask) as isize).unchecked_add(offset)) as usize,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue