ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

First One
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Lucas Braesch



Joined: 31 May 2010
Posts: 1757

PostPost subject: Re: First One    Posted: Sun May 27, 2012 12:16 pm Reply to topic Reply with quote

José Carlos wrote:
Hi. Sorry if this has already been answered before.
I'm trying to compile an old engine of mine in 64 bits. I have some old asm code for FirstOne() (left and right, I mean, MSB and LSB) which won't compile for X64.
Is there some C code out there I can use for the tasks?
I don't care much for speed. I just want it to be problem-free.

Thanks in advance.

From Stockfish. fast and portable
Code:
static const unsigned BitTable[NB_SQUARE] = {
   0, 1, 2, 7, 3, 13, 8, 19, 4, 25, 14, 28, 9, 34, 20, 40, 5, 17, 26, 38, 15,
   46, 29, 48, 10, 31, 35, 54, 21, 50, 41, 57, 63, 6, 12, 18, 24, 27, 33, 39,
   16, 37, 45, 47, 30, 53, 49, 56, 62, 11, 23, 32, 36, 44, 52, 55, 61, 22, 43,
   51, 60, 42, 59, 58
};

unsigned first_bit(uint64_t b)
/* From Stockfish */
{
   return BitTable[((b & -b) * 0x218a392cd3d5dbfULL) >> 58];
}
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
First One José C. Martínez Galán Thu May 24, 2012 4:02 pm
      Re: First One Sven Schüle Thu May 24, 2012 4:27 pm
      Re: First One Jim Ablett Thu May 24, 2012 4:35 pm
      Re: First One José C. Martínez Galán Thu May 24, 2012 7:48 pm
      Re: First One Robert Hyatt Thu May 24, 2012 8:28 pm
      Re: First One Jon Dart Thu May 24, 2012 8:43 pm
            Re: First One Ron Murawski Fri May 25, 2012 4:57 am
      Re: First One Lucas Braesch Sun May 27, 2012 12:16 pm
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads