Computer Chess Club Archives


Search

Terms

Messages

Subject: Eugene's portable C version of FirstOne()

Author: Russell Reagan

Date: 20:57:49 08/16/02


In an old message in the CCC archive, Eugene Nalimov gave a portable C version
of FirstOne().

int FirstOne (__int64 arg) {
__int64 result = 0;

if (arg > 0xFFFFFFFF) {
arg >>= 32;
result = 32;
}
if (arg > 0xFFFF) {
arg >>= 16;
result += 16;
}
if (arg > 0xFF) {
arg >>= 8;
result += 8;
}
return first_one_8bit[arg];
}

What is 'result' used for? As far as I can tell it doesn't affect the return
value at all. Is the return line supposed to be:

return result + first_one_8bit[arg]; // ?

Also, this returns the highest bit (most significant), right?

Thanks,
Russell



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.