Ejemplo n.º 1
0
bool FInitHashe(PCON pcon)
{
    if( hashBuffer ) {
        free( hashBuffer );
        hashBuffer = 0;
    }
    s_chashdMac = 15;
    int cbMaxHash = uciHash.get_spin();

    if( cbMaxHash <= 0 || cbMaxHash > 1024 )
        cbMaxHash = 32;
    cbMaxHash *= 1024*1024;
    chashdMax = 1;
    for (;;) {
        if (chashdMax * 2 * (int)sizeof(HASHD) > cbMaxHash)
            break;
        chashdMax *= 2;
    }
    VPrSendComment("%d Kbytes main hash memory (%d entries)", chashdMax * sizeof(HASHD) / 1024, chashdMax);
    Assert( sizeof(HASHD) == 16 );
    hashBuffer = (RGHASHD) malloc( 64 + chashdMax * sizeof(HASHD));
    if ( hashBuffer == NULL) {
        VPrSendComment("Can't allocate hash memory: %d bytes",
                       chashdMax * sizeof(HASHD));
        return false;
    }
    s_rghashd = (RGHASHD) ((U64(hashBuffer)+63) & (~63));
    s_chashdMac = ((chashdMax / BUCKET_SIZE) - 1) * BUCKET_SIZE;
    stats.Hsize = chashdMax;
    VClearHashe();
    return true;
}
Ejemplo n.º 2
0
BOOL FPrSetboard(void * pv, char * szFen)
{
	PCON pcon = pv;

	Assert(pcon->smode == smodeIDLE);
	VClearHashe();
	VClearHashp();
	pcon->fDrawOffered = fFALSE;
	return FInitCon(pcon, szFen);
}