Fixed calcWins_slow for 31 high boards

This commit is contained in:
AnnaSnoeijs 2025-08-14 20:05:18 +02:00
parent bb344cb956
commit 214112ad17

View file

@ -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 ]