Skip to content

Commit

Permalink
bitintr is incompatible with newer rust
Browse files Browse the repository at this point in the history
  • Loading branch information
primenumber committed Feb 9, 2024
1 parent 8d83494 commit a4f10b6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version = "0.2.0"
authors = ["prime <prime@kmc.gr.jp>"]

[dependencies]
bitintr = "0.3"
lazy_static = "1.4"
rand = { version = "0.8", features = ["small_rng"] }
rand_xoshiro = "0.6"
Expand Down
6 changes: 3 additions & 3 deletions src/engine/bits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bitintr::{Pdep, Pext};
use core::arch::x86_64::{_pdep_u64, _pext_u64};
use lazy_static::lazy_static;

pub fn popcnt(x: u64) -> i8 {
Expand Down Expand Up @@ -45,12 +45,12 @@ pub fn mirror_under_8(mut x: u64) -> u64 {
}

pub fn pext(x: u64, mask: u64) -> u64 {
x.pext(mask)
unsafe { _pext_u64(x, mask) }
}

#[allow(dead_code)]
pub fn pdep(x: u64, mask: u64) -> u64 {
x.pdep(mask)
unsafe { _pdep_u64(x, mask) }
}

lazy_static! {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/endgame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::engine::hand::*;
use crate::engine::search::*;
use crate::engine::table::*;
use arrayvec::ArrayVec;
use bitintr::Tzcnt;
use core::arch::x86_64::_tzcnt_u64;
use std::cmp::max;

fn near_leaf(solve_obj: &mut SolveObj, board: Board) -> (i8, SolveStat) {
Expand Down Expand Up @@ -59,7 +59,7 @@ fn static_order(solve_obj: &mut SolveObj, board: Board, (mut alpha, beta): (i8,
for mask in MASKS.iter() {
let mut remain = mobility_bits & mask;
while remain != 0 {
let pos = remain.tzcnt() as usize;
let pos = unsafe { _tzcnt_u64(remain) } as usize;
remain = remain & (remain - 1);
if let Some(next) = board.play(pos) {
pass = false;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/last_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mod test;
use crate::engine::bits::*;
use crate::engine::board::*;
use bitintr::Tzcnt;
use core::arch::x86_64::_tzcnt_u64;

pub struct LastCache {
table: [(i8, i8); 4096],
Expand Down Expand Up @@ -65,7 +65,7 @@ impl LastCache {
}

unsafe fn solve_last_impl(&self, board: Board) -> (i8, usize) {
let pos = board.empty().tzcnt() as usize;
let pos = _tzcnt_u64(board.empty()) as usize;
let row = pos >> 3;
let col = pos & 0b111;
let row_bits = (board.player >> (row * 8)) & 0xff;
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(test)]
#![feature(stdsimd)]
mod book;
mod engine;
mod play;
Expand Down

0 comments on commit a4f10b6

Please sign in to comment.