Hi,
unless I'm mistaken, the fms() function is equivalent to log2f(), but the former is in asm while the latter is in C.
Generally, I'd like to have a libmath.c with all these mathematical functions. Having a file only for log2 variants is not exactly the most optimal tree organization.
How do we treat functions which have an optimized asm version but also exist as C code? - Weak functions? - Macro tricks like #ifdef _HAVE_ARCH_LOG2C ? - Kill the optimized asm completely?
Regards, Carl-Daniel
On Thu, Sep 4, 2008 at 8:08 AM, Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
Hi,
unless I'm mistaken, the fms() function is equivalent to log2f(), but the former is in asm while the latter is in C.
Let's get rid of fms then.
Generally, I'd like to have a libmath.c with all these mathematical functions. Having a file only for log2 variants is not exactly the most optimal tree organization.
How do we treat functions which have an optimized asm version but also exist as C code?
- Weak functions?
- Macro tricks like #ifdef _HAVE_ARCH_LOG2C ?
- Kill the optimized asm completely?
(3). If you can do it in C, then asm goes away. I'd like to shoot all asm in the head.
Also, please, let's minimize code in .h files. It just adds to (my) the confusion :-)
The type of gratuitous use of assembly we sometimes see is Clever. This: http://research.swtch.com/2008/05/lessons-from-debianopenssl-fiasco.html has an important point about Clever:
"# Try not to write clever code. Try to write well-organized code."
"# Inevitably, you will write clever, poorly-organized code. If someone comes along asking questions about it, use that as a sign that perhaps the code is probably too clever or not well enough organized. Rewrite it to be simpler and easier to understand."
"# Avoid voodoo code. "
optimizing log2 in assembly when we call it almost never is, well, Clever. Let's avoid it.
ron