Reflection of a bitboard

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Reflection of a bitboard

Post by hgm »

There is no need to use something like AL/AH; you can just do

MOVZX EAX,100(EBP)
...
MOVZX EAX,101(EBP)
...
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: Reflection of a bitboard

Post by stegemma »

Ah ok, you're talking about accessing the data from memory, not from the register. This would lead to misaligned access to memory and it seems not so good.

For a row per row permutation, it can be used XLAT instruction, that requires only a 256 byte table. You load rdx with the offset of the table, rax with x, 0 in rbx and then you can omit "& 0xff", just rotate by 8 rax and call XLAT, then store al to bl and rotate rbx.
Author of Drago, Raffaela, Freccia, Satana, Sabrina.
http://www.linformatica.com
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Reflection of a bitboard

Post by hgm »

For byte access there is no such thing as 'misaligned access'. The latter is defined as accessing an address that is not a multiple of the size of the data. But everything is a multiple of 1.

BTW, note that misalinged accesses on i386 or x64 CPUs do not carry any performance penalty when they do not straddle a cache line (64 bytes).