Discussion of chess software programming and technical issues.
Moderators: hgm , Rebel , chrisw
mar
Posts: 2555 Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak
Post
by mar » Tue Apr 16, 2013 5:55 am
Awesome, Gerd.
Thanks!
cms271828
Posts: 316 Joined: Wed Apr 12, 2006 10:47 pm
Post
by cms271828 » Fri Apr 26, 2013 6:13 pm
I like this browser version tool:
http://butterflychess.altervista.org/bi ... tml?type=0
But I found a small problem with it..
The highest bit(63) has decimal value 2^63,
But I'm guessing typical programming languages would use -2^63 for this bit, to give the nice range -2^63 ... 2^63-1
Colin
AlvaroBegue
Posts: 931 Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)
Post
by AlvaroBegue » Fri Apr 26, 2013 7:39 pm
There are signed and unsigned types, and an unsigned type should be used for bitboards. If you use an unsigned type, the 64-bit integer with the highest-bit set represents +2^63.
cms271828
Posts: 316 Joined: Wed Apr 12, 2006 10:47 pm
Post
by cms271828 » Fri Apr 26, 2013 7:45 pm
Well that's true in C, but I'm using java.
A "long (64 bit)" in java is from -2^63 to 2^63-1, so I don't think I have any other choice but to use negatives (when the highest bit is 1).
It makes no difference to my code, but I would have to use that bitboard tool with caution.
Colin
AlvaroBegue
Posts: 931 Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)
Post
by AlvaroBegue » Fri Apr 26, 2013 7:51 pm
cms271828 wrote: Well that's true in C, but I'm using java.
A "long (64 bit)" in java is from -2^63 to 2^63-1, so I don't think I have any other choice but to use negatives (when the highest bit is 1).
It makes no difference to my code, but I would have to use that bitboard tool with caution.
I would use Java with caution.
By using a signed type, shifts to the right behave funny, propagating the sign bit instead of introducing zeros at the left end.
cms271828
Posts: 316 Joined: Wed Apr 12, 2006 10:47 pm
Post
by cms271828 » Fri Apr 26, 2013 7:59 pm
Yes, thats why you can use >>> to bring in 0's, or >> to bring in 1's (if its already negative).
Colin