Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: oops

Author: Bo Persson

Date: 08:48:19 11/26/00

Go up one level in this thread


On November 26, 2000 at 11:32:27, Severi Salminen wrote:

>On November 26, 2000 at 11:22:17, Dan Andersson wrote:
>
>>In a 32 bit processor how long is an integer?
>
>Hmm...54 bits? No? In x86 family the size of an integer can be 8,16 or 32 bits.
>It is not allways 32 bits. It is the matter of compiler/OS what size it chooses.
>Nowadays 32 bit is the most common when using INT or LONG (in C or C++)
>
>The point is that the programmer doesn't have to consider that. When I use 64
>bit integers the compiler takes care of the two halves and I don't have to.
>Usually compilers produce faster code than manually writeing assembler. So when
>one uses 64 bit bitboards in chess program and divides them to two 32 bit
>integers it makes me ask why. Probably he has some other reason than the size of
>E?? registers? I don't know - that's why I asked. If he is using a compiler
>which can't use 64 bit integers (LONG LOGN or __int64) then it is clear.
>

The original reason was that I did this long before __int64 became available.

But still, even though VC++ now supports __int64, it doesn't do it extremely
well. Many of the operations are subroutine calls, while my BitBoard class
inlines all its functions.

Also, you can often shortcut an operation if you can decide the outcome after 32
bits. When you AND two bitmaps to see if they overlap, and the first halves
does, you don't have to test the second half.


Bo Persson
bop@malmo.mail.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.