Computer Chess Club Archives


Search

Terms

Messages

Subject: Puzzling Assembler Question

Author: James Robertson

Date: 14:41:59 02/19/04


... 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?

Thanks,
James



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.