@@ -558,7 +558,8 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 {
558
558
assert_ne ! ( bm, MOVE_NONE ) ;
559
559
assert ! ( bs >= -EVAL_INF && bs <= EVAL_INF ) ;
560
560
561
- if _ply == 0 { bm } else { bs } //best move at the root node, best score elsewhere
561
+ // best move at the root node, best score elsewhere
562
+ if _ply == 0 { bm } else { bs }
562
563
}
563
564
564
565
/// Evaluation function: give different scores to different patterns after a fixed depth.
@@ -570,15 +571,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
570
571
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
571
572
{
572
573
if check_x86_avx512_features ( ) {
573
- unsafe {
574
- if check_patternlive4_avx512 ( pos, def) {
575
- return -4096 ;
576
- }
577
- }
578
- } else {
579
- if check_patternlive4 ( pos, def) {
574
+ if unsafe { check_patternlive4_avx512 ( pos, def) } {
580
575
return -4096 ;
581
576
}
577
+ } else if check_patternlive4 ( pos, def) {
578
+ return -4096 ;
582
579
}
583
580
}
584
581
@@ -593,15 +590,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
593
590
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
594
591
{
595
592
if check_x86_avx512_features ( ) {
596
- unsafe {
597
- if check_patternlive4_avx512 ( pos, atk) {
598
- return 2560 ;
599
- }
600
- }
601
- } else {
602
- if check_patternlive4 ( pos, atk) {
593
+ if unsafe { check_patternlive4_avx512 ( pos, atk) } {
603
594
return 2560 ;
604
595
}
596
+ } else if check_patternlive4 ( pos, atk) {
597
+ return 2560 ;
605
598
}
606
599
}
607
600
@@ -616,15 +609,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
616
609
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
617
610
{
618
611
if check_x86_avx512_features ( ) {
619
- unsafe {
620
- if check_patterndead4_avx512 ( pos, atk) > 0 {
621
- return 2560 ;
622
- }
623
- }
624
- } else {
625
- if check_patterndead4 ( pos, atk) > 0 {
612
+ if unsafe { check_patterndead4_avx512 ( pos, atk) > 0 } {
626
613
return 2560 ;
627
614
}
615
+ } else if check_patterndead4 ( pos, atk) > 0 {
616
+ return 2560 ;
628
617
}
629
618
}
630
619
@@ -909,9 +898,7 @@ fn pos_is_winner_avx512(pos: &Pos) -> bool {
909
898
0b00_10_10_10_10_11_10_10_10_10_11_11_11_11_11_10 ] ;
910
899
let mut count_match: i32 = 0 ;
911
900
912
- for dir in 0 ..2 {
913
- // direction 0 and 1
914
- let mut board0 = board0org[ dir] ;
901
+ for mut board0 in board0org {
915
902
let boardf = _mm512_and_si512 ( answer, board0) ;
916
903
let temp_mask = _mm512_mask_cmpeq_epi16_mask ( answer_mask[ 0 ] , answer, boardf) ;
917
904
count_match += _popcnt32 ( temp_mask as i32 ) ;
0 commit comments