Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MSRV and fix new clippy warnings #82

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "monty"
version = "1.0.0"
edition = "2021"
authors = ["Jamie Whiting"]
rust-version = "1.83"

[profile.release]
panic = 'abort'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default:
cargo rustc --release --bin monty --features=embed -- -C target-cpu=native --emit link=$(NAME)

montytest:
cargo rustc --release --bin monty --features=uci-minimal,tunable -- -C target-cpu=native --emit link=$(NAME)
cargo +stable rustc --release --bin monty --features=uci-minimal,tunable -- -C target-cpu=native --emit link=$(NAME)

noembed:
cargo rustc --release --bin monty -- -C target-cpu=native --emit link=$(NAME)
Expand Down
4 changes: 2 additions & 2 deletions src/tree/half.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl TreeHalf {

unsafe {
use std::mem::MaybeUninit;
let chunk_size = (size + threads - 1) / threads;
let chunk_size = size.div_ceil(threads);
let ptr = res.nodes.as_mut_ptr().cast();
let uninit: &mut [MaybeUninit<Node>] = std::slice::from_raw_parts_mut(ptr, size);

Expand Down Expand Up @@ -83,7 +83,7 @@ impl TreeHalf {

fn clear_ptrs_multi_threaded(&self, threads: usize) {
std::thread::scope(|s| {
let chunk_size = (self.nodes.len() + threads - 1) / threads;
let chunk_size = self.nodes.len().div_ceil(threads);

s.spawn(move || {
for node_chunk in self.nodes.chunks(chunk_size) {
Expand Down
4 changes: 2 additions & 2 deletions src/tree/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct HashTable {

impl HashTable {
pub fn new(size: usize, threads: usize) -> Self {
let chunk_size = (size + threads - 1) / threads;
let chunk_size = size.div_ceil(threads);

let mut table = HashTable { table: Vec::new() };
table.table.reserve_exact(size);
Expand All @@ -65,7 +65,7 @@ impl HashTable {
}

pub fn clear(&mut self, threads: usize) {
let chunk_size = (self.table.len() + threads - 1) / threads;
let chunk_size = self.table.len().div_ceil(threads);

std::thread::scope(|s| {
for chunk in self.table.chunks_mut(chunk_size) {
Expand Down
Loading