Rust zip bad, itertools zip good

This commit is contained in:
Luke Hubmayer-Werner 2022-02-05 12:02:39 +10:30
parent 292bd581a5
commit c35851551b
2 changed files with 3 additions and 6 deletions

View File

@ -9,3 +9,4 @@ edition = "2021"
regex = "1"
rayon = "1.5"
bitintr = "0.3.0"
itertools = "0.10.2"

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
use bitintr::{Lzcnt, Tzcnt};
use regex::Regex;
use rayon::prelude::*;
//use itertools::Itertools;
use itertools::zip;
type Charmask = i32;
type Achar = i8; // ASCII char
@ -119,11 +119,7 @@ fn generate_wordcache(words: Vec<Word>) -> WordCache {
}
fn filter_word(w: &[Charmask; WORD_LENGTH_P], banned_chars: &[Charmask; WORD_LENGTH_P]) -> bool {
w.iter().zip(banned_chars.iter()).all(|(x,y)| x & y == 0)
// for i in 0..WORD_LENGTH {
// if w[i] & banned_chars[i] != 0 {return false;}
// }
// true
zip(w, banned_chars).all(|(x,y)| x & y == 0)
}
fn simulate(guess_ids: [usize; GUESS_DEPTH], solution_id: usize, mut s: SimState, wordcache: &WordCache) -> usize {