mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Kernel's X86 ffs() doesn't work on constants.
@ 2001-11-28 22:39 Justin T. Gibbs
  2001-11-28 23:00 ` H. Peter Anvin
  0 siblings, 1 reply; 2+ messages in thread
From: Justin T. Gibbs @ 2001-11-28 22:39 UTC (permalink / raw)
  To: linux-kernel

If you attempt to call ffs(SOME_CONSTAT) in an x86 kernel under
Linux, you get messages like this:

{standard input}: Assembler messages:
{standard input}:14864: Error: suffix or operands invalid for `bsf'

I'm not enough of a GCC asm syntax guru to understand why the
compiler/assembler doesn't handle this, but it is hightly anoying.

"Why not just code in the constant bit offset?", you ask?  If
the constant the bit offset is based on is ever changed, I must
recognize that the change occured and change the second constant.
For constants that are maintained outside of my code, I'd rather
code the dependency once and let the compiler ensure that the constants
are in sync.

--
Justin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-11-28 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-28 22:39 Kernel's X86 ffs() doesn't work on constants Justin T. Gibbs
2001-11-28 23:00 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome