Search found 230 matches

by Pradu
Fri Aug 07, 2009 6:27 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Bit twiddlement question: greater of two popcounts
Replies: 18
Views: 3792

Re: Bit twiddlement question: greater of two popcounts

And perhaps the even less useful 32-bit popcnt: int popcnt_under32(U64 x) { const U64 k1 = C64(0x1111111111111111); const U64 k3 = C64(0x3333333333333333); const U64 k5 = C64(0x5555555555555555); const U64 k0F = C64(0x0F0F0F0F0F0F0F0F); const U64 k01 = C...
by Pradu
Fri Aug 07, 2009 6:11 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Bit twiddlement question: greater of two popcounts
Replies: 18
Views: 3792

Re: Bit twiddlement question: greater of two popcounts

bool popcnt_a_ge_b(a,b) { const U64 k1 = C64(0x5555555555555555); a = a - ((a >> 1) & k1); b = b - ((b >> 1) & k1); a *= k1; b *= k1; return (a >= b); } Very cool! It looks like you could make this into a popcount when number of bits <=4: bo...
by Pradu
Tue Jul 07, 2009 7:39 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Important Linux update
Replies: 12
Views: 2569

Re: Important Linux update

http://software.intel.com/en-us/blogs/2006/10/19/why-windows-threads-are-better-than-posix-threads/ I saw this post a really long time back. Basically the guy posting it wanted to start up a lively discussion comparing Windows threads and POSIX threads. Here's a post by the same guy saying that "PO...
by Pradu
Tue May 26, 2009 2:24 am
Forum: Computer Chess Club: General Topics
Topic: 2009 ACCA World Computer Rapid Chess Championships
Replies: 127
Views: 23202

Re: 2009 ACCA World Computer Rapid Chess Championships

CRoberson wrote:Saturday and Sunday August 22 & 23
I first preference is 22&23. My second preference would be 15&16. All weekends in August are fine for me.
by Pradu
Mon May 11, 2009 8:44 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Fast rook mobility counting
Replies: 8
Views: 1588

Re: Fast rook mobility counting

I misread yoru post, I just read your posted code... let me think about it.

Code: Select all

const uint64 BothDiag = ?????????ULL;

int bishop_mob_count&#40;uint64 b, int sq&#41; 
&#123;
    uint64 bb = b * BothDiag;

    return &#40;bb >> shiftD&#91;sq&#93;) + &#40;bb >> shiftAD&#91;sq&#93;);
&#125;
by Pradu
Mon May 11, 2009 8:33 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Fast rook mobility counting
Replies: 8
Views: 1588

Re: Fast rook mobility counting

It would be very interesting to find a number BothDiag so that we sum all ones in 1 go, the diagonal summing on a bit and the anti-diagonal on a different bit so that for a full bishop attack it becomes const uint64 BothDiag = ?????????ULL; int bishop_mob_count(uint64 b, int sq) { uint...
by Pradu
Mon May 11, 2009 1:18 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Fast rook mobility counting
Replies: 8
Views: 1588

Re: Fast rook mobility counting

Hopefully, because we are trying to do popcounts, they can get significantly smaller than move-bitboard databases. Well, it's for sure going to be significantly smaller. For each diagonal/anti-diagonal and file you can for sure reduce it to a minimal hash by making every bit shift to the same index...
by Pradu
Mon May 11, 2009 1:06 am
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: Fast rook mobility counting
Replies: 8
Views: 1588

Re: Fast rook mobility counting

Nice. For all bishop squares you can for sure do it with two multiplys an add, and a rightshift using the same technique. For many bishop squares you can for sure do it with just one multiply and a right shift. It is possible to do it for both rooks and bishops with one multiply and a right-shift wi...
by Pradu
Sun May 10, 2009 8:54 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: fast mobility count through hashing
Replies: 22
Views: 4385

Re: fast mobility count through hashing

we are ramping up fast on this combinatorial escalation. I'm guessing this is the reason why many programs are distributed without binaries. But for a closed-source program this could indeed be a problem but atleast for computer-chess it isn't too bad. For example if you have a chess engine that ta...
by Pradu
Sun May 10, 2009 8:18 pm
Forum: Computer Chess Club: Programming and Technical Discussions
Topic: fast mobility count through hashing
Replies: 22
Views: 4385

Re: fast mobility count through hashing

I have one question regarding runtime check of CPU capabilities. Well, I don't do it at runtime. I have a Makefile that generates an executable that creates a Makefile with CPU info in it and subsequently I include the generated Makefile into the original Makefile so it will optimize for the platfo...