Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: YABRA

Author: Matt Taylor

Date: 23:01:27 01/24/03

Go up one level in this thread


On January 24, 2003 at 23:09:24, Dann Corbit wrote:

>typedef unsigned __int64 Bitboard;
>/*
>From:
>http://www.mostang.com/~davidm/papers/expo97/paper/doc005.html
>*/
>Bitboard byterev_long (Bitboard L) {
>  static const Bitboard mask = 0x0101010101010101;
>  return (((L & (mask << 0)) << 7) | ((L >> 7) & (mask << 0)) |
>          ((L & (mask << 1)) << 5) | ((L >> 5) & (mask << 1)) |
>          ((L & (mask << 2)) << 3) | ((L >> 3) & (mask << 2)) |
>          ((L & (mask << 3)) << 1) | ((L >> 1) & (mask << 3)));
>}

Same thing as this which I implemented:

int byterev(int i)
{
    i = ((i << 4) & 0xF0F0F0F0) | ((i & 0xF0F0F0F0) >> 4);
    i = ((i << 2) & 0xCCCCCCCC) | ((i & 0xCCCCCCCC) >> 2);
    i = ((i << 1) & 0xAAAAAAAA) | ((i & 0xAAAAAAAA) >> 1);

    return i;
}

-Matt



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.