Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Puzzling Assembler Question

Author: Dann Corbit

Date: 15:16:17 02/19/04

Go up one level in this thread


On February 19, 2004 at 17:41:59, James Robertson wrote:

>... puzzling for me at least. A short time ago the following code compiled
>nicely on the server machines using linux/g++ at my school:
>
>inline int FirstSetBit(unsigned long long a)
>{
>  asm ("
>    bsf	4(%0), %%eax
>    add	$32, %%eax
>    bsf	(%0), %%eax
>    ":: "r"(&a): "%eax");
>}
>
>Since that time I suppose that there have been a number of upgrades and so forth
>to my school computers. Unfortunately, now I get a number of errors. I fixed the
>first few by simply appending ; \ to each line, but the compiler is still
>unhappy. Specifically, it complains that the '%eax' register is unknown on the
>final line. Can anyone give me any help?

You might want to examine here and below for an alternative pure C model that
seems to be just about the same speed:
http://www.talkchess.com/forums/1/message.html?349781



This page took 0.01 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.