Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards in C vs. bitboards in C++

Author: Bo Persson

Date: 03:57:39 08/18/02

Go up one level in this thread


On August 17, 2002 at 21:27:08, Russell Reagan wrote:

>I was wondering if there is any speed hit in creating a Bitboard class as some
>bitboard engines do, as opposed to using the simple C version. For example, in
>Resp a Bitboard class is used, and I am not sure if it's a good implementation
>(not to imply that it isn't). The author does things like:
>
>class Bitboard {
>// ...
>  public:
>    FORCEINLINE Bitboard operator &= (const Bitboard& b)
>    {
>        bits &= b.bits;
>        return *this;
>    }
>  private:
>    UINT64 bits;
>};
>

You could use a "const Bitboard&" return value, instead of copying the result.
This would still allow you to use

  if (b1 &= b2)

like Gerd suggests, even though it looks ugly :-).

A reasonable optimizer will remove any excess after inlining anyway.



Bo Persson
bop2@telia.com





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.