Fixed calcWins_slow for 31 high boards
This commit is contained in:
parent
bb344cb956
commit
214112ad17
1 changed files with 6 additions and 1 deletions
7
logic.c
7
logic.c
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbit.h>
|
||||
#include <stdio.h>
|
||||
#include "logic.h"
|
||||
#include "macros.h"
|
||||
|
||||
|
|
@ -43,7 +44,8 @@ static void updateTotal( wincount_t *count ){
|
|||
|
||||
// popcount for a column
|
||||
static winint_t popcnt_column( column_t column ){
|
||||
winint_t i = (winint_t)stdc_count_ones( column );
|
||||
winint_t i = (winint_t)__builtin_popcountg( (uint64_t)column );
|
||||
//if( i > 32 ) printf( "%d %lb", i, column ); // TODO: REMOVE
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -119,6 +121,7 @@ void calcWins_slow( board_t *boardptr ){
|
|||
& safeHeightMask( boardptr->height[ column + 1 ] )
|
||||
& safeHeightMask( boardptr->height[ column + 2 ] )
|
||||
& safeHeightMask( boardptr->height[ column + 3 ] )
|
||||
& ( ( (column_t)1 << (column_t)boardptr->rows ) - (column_t)1 )
|
||||
);
|
||||
boardptr->count1.horizontal += popcnt_column(
|
||||
boardptr->column[ column ]
|
||||
|
|
@ -136,6 +139,7 @@ void calcWins_slow( board_t *boardptr ){
|
|||
& safeHeightMask( boardptr->height[ column + 1 ] - 1 )
|
||||
& safeHeightMask( boardptr->height[ column + 2 ] - 2 )
|
||||
& safeHeightMask( boardptr->height[ column + 3 ] - 3 )
|
||||
& ( ( (column_t)1 << (column_t)boardptr->rows ) - (column_t)1 )
|
||||
);
|
||||
boardptr->count1.diagonalUp += popcnt_column(
|
||||
boardptr->column[ column ]
|
||||
|
|
@ -158,6 +162,7 @@ void calcWins_slow( board_t *boardptr ){
|
|||
boardptr->height[ column + 3 ] + 3
|
||||
)
|
||||
)
|
||||
& ( ( (column_t)1 << (column_t)boardptr->rows ) - (column_t)1 )
|
||||
);
|
||||
boardptr->count1.diagonalDown += popcnt_column(
|
||||
boardptr->column[ column ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue