From a8c2d7499de2215e2ffb3c755361a339e5b798d3 Mon Sep 17 00:00:00 2001 From: Micha White Date: Thu, 21 Dec 2023 19:40:02 -0500 Subject: Fix warnings --- Cargo.toml | 2 +- engine/src/lib.rs | 18 +++--------------- engine/src/main.rs | 2 +- engine/src/stackvec.rs | 35 ----------------------------------- 4 files changed, 5 insertions(+), 52 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 560f992..4c88f9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = [ "engine", "model", - "pdn" + #"pdn" ] [profile.dev] diff --git a/engine/src/lib.rs b/engine/src/lib.rs index fdb50e6..8f9fde2 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -3,10 +3,10 @@ #![feature(maybe_uninit_slice)] use std::num::{NonZeroU8, NonZeroUsize}; -use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::Arc; use std::thread::JoinHandle; -use std::time::{Duration, Instant}; +use std::time::Duration; use parking_lot::Mutex; @@ -18,7 +18,7 @@ pub use transposition_table::{TranspositionTable, TranspositionTableRef}; mod eval; mod lazysort; mod stackvec; -mod tablebase; +//mod tablebase; mod transposition_table; pub const ENGINE_NAME: &str = "Ampere"; @@ -46,11 +46,7 @@ struct EvaluationTask<'a> { cancel_flag: AtomicBool, end_ponder_flag: AtomicBool, - start_time: Instant, - current_depth: AtomicU8, - selective_depth: AtomicU8, nodes_explored: AtomicUsize, - principle_variation: Mutex>, } #[derive(Debug, Default, Clone)] @@ -205,11 +201,7 @@ impl<'a> Engine<'a> { let cancel_flag = AtomicBool::new(false); let end_ponder_flag = AtomicBool::new(false); - let start_time = Instant::now(); - let current_depth = AtomicU8::new(0); - let selective_depth = AtomicU8::new(0); let nodes_explored = AtomicUsize::new(0); - let principle_variation = Mutex::new(Vec::new()); let task = EvaluationTask { position, @@ -220,11 +212,7 @@ impl<'a> Engine<'a> { cancel_flag, end_ponder_flag, - start_time, - current_depth, - selective_depth, nodes_explored, - principle_variation, }; let task = Arc::new(task); diff --git a/engine/src/main.rs b/engine/src/main.rs index 3b41418..32e0f62 100644 --- a/engine/src/main.rs +++ b/engine/src/main.rs @@ -11,7 +11,7 @@ const DEPTH: u8 = 19; struct BasicFrontend; impl Frontend for BasicFrontend { - fn debug(&self, msg: &str) {} + fn debug(&self, _: &str) {} fn report_best_move(&self, best_move: model::Move) { println!("{best_move}"); diff --git a/engine/src/stackvec.rs b/engine/src/stackvec.rs index 9c00461..cfdef2b 100644 --- a/engine/src/stackvec.rs +++ b/engine/src/stackvec.rs @@ -39,10 +39,6 @@ impl StackVec { } } - pub fn capcity(&self) -> usize { - CAPACITY - } - pub fn len(&self) -> usize { self.len } @@ -61,39 +57,8 @@ impl StackVec { unsafe { MaybeUninit::slice_assume_init_mut(&mut self.values[..self.len]) } } - pub fn as_ptr(&self) -> *const T { - self.values.as_ptr().cast() - } - - pub fn as_mut_ptr(&mut self) -> *mut T { - self.values.as_mut_ptr().cast() - } - - pub fn try_push(&mut self, value: T) -> Option<()> { - self.values.get_mut(self.len)?.write(value); - self.len += 1; - Some(()) - } - pub fn push(&mut self, value: T) { self.values[self.len].write(value); self.len += 1; } - - pub fn pop(&mut self) -> Option { - if self.is_empty() { - return None; - } - - // safety: this value will no longer be used, and the value is valid - // because it appears in the valid part of the array - unsafe { - self.len -= 1; - Some(std::ptr::read(self.as_ptr().add(self.len()))) - } - } - - pub fn clear(&mut self) { - self.len = 0; - } } -- cgit v1.2.3