All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Hartgers <bart@etpmod.phys.tue.nl>
To: Carlos Munoz <carlos@kenati.com>
Cc: Denis Vlasenko <vda@ilport.com.ua>,
	Lee Revell <rlrevell@joe-job.com>,
	Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org,
	alsa-devel <alsa-devel@lists.sourceforge.net>
Subject: Re: How can I link the kernel with libgcc ?
Date: Fri, 10 Mar 2006 12:05:06 +0100	[thread overview]
Message-ID: <44115D62.6000100@etpmod.phys.tue.nl> (raw)
In-Reply-To: <200603101237.35687.vda@ilport.com.ua>

Denis Vlasenko wrote:
> On Friday 10 March 2006 05:47, Carlos Munoz wrote:
>> Lee Revell wrote:
> 
> What? You are using log10 only twice!
> 
>         if (!(siu_obj_status & ST_OPEN)) {
> 		...
>                 /* = log2(over) */
>                 ydef[22] = (u_int32_t)(log10((double)(over & 0x0000003f)) /
>                                        log10(2));
> 		...
>         }
>         else {
> 		...
>                 if (coef) {
>                         ydef[16] = 0x03045000 | (over << 26) | (tap - 4);
>                         ydef[17] = (tap * 2 + 1);
>                         /* = log2(over) */
>                         ydef[22] = (u_int32_t)
>                                 (log10((double)(over & 0x0000003f)) / log10(2));
>                 }
> 
> Don't you think that log10((double)(over & 0x0000003f)) / log10(2)
> can have only 64 different values depending on the result of (over & 0x3f)?
> 
> Obtain them from precomputed uint32_t log10table[64].

And since you're actually trying to do log2 [log10(x)/log10(2) =
log2(x)] and casting the result to an integer, aren't you really looking
for the position of the highest 1 bit or something like that? That
doesn't need FP at all.

Groeten,
Bart

> --
> vda
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


-- 
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

WARNING: multiple messages have this Message-ID (diff)
From: Bart Hartgers <bart@etpmod.phys.tue.nl>
To: Carlos Munoz <carlos@kenati.com>
Cc: Denis Vlasenko <vda@ilport.com.ua>,
	Lee Revell <rlrevell@joe-job.com>,
	Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org,
	alsa-devel <alsa-devel@lists.sourceforge.net>
Subject: Re: How can I link the kernel with libgcc ?
Date: Fri, 10 Mar 2006 12:05:06 +0100	[thread overview]
Message-ID: <44115D62.6000100@etpmod.phys.tue.nl> (raw)
In-Reply-To: <200603101237.35687.vda@ilport.com.ua>

Denis Vlasenko wrote:
> On Friday 10 March 2006 05:47, Carlos Munoz wrote:
>> Lee Revell wrote:
> 
> What? You are using log10 only twice!
> 
>         if (!(siu_obj_status & ST_OPEN)) {
> 		...
>                 /* = log2(over) */
>                 ydef[22] = (u_int32_t)(log10((double)(over & 0x0000003f)) /
>                                        log10(2));
> 		...
>         }
>         else {
> 		...
>                 if (coef) {
>                         ydef[16] = 0x03045000 | (over << 26) | (tap - 4);
>                         ydef[17] = (tap * 2 + 1);
>                         /* = log2(over) */
>                         ydef[22] = (u_int32_t)
>                                 (log10((double)(over & 0x0000003f)) / log10(2));
>                 }
> 
> Don't you think that log10((double)(over & 0x0000003f)) / log10(2)
> can have only 64 different values depending on the result of (over & 0x3f)?
> 
> Obtain them from precomputed uint32_t log10table[64].

And since you're actually trying to do log2 [log10(x)/log10(2) =
log2(x)] and casting the result to an integer, aren't you really looking
for the position of the highest 1 bit or something like that? That
doesn't need FP at all.

Groeten,
Bart

> --
> vda
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


-- 
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/

  reply	other threads:[~2006-03-10 11:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-10  1:44 How can I link the kernel with libgcc ? Carlos Munoz
2006-03-10  1:45 ` Valdis.Kletnieks
2006-03-10  2:06   ` Lee Revell
2006-03-10  3:01     ` Carlos Munoz
2006-03-10  3:22       ` Lee Revell
2006-03-10  3:22         ` Lee Revell
2006-03-10  3:25       ` Carlos Munoz
2006-03-10  3:25         ` Lee Revell
2006-03-10  3:47           ` Carlos Munoz
2006-03-10 10:37             ` Denis Vlasenko
2006-03-10 11:05               ` Bart Hartgers [this message]
2006-03-10 11:05                 ` Bart Hartgers
2006-03-10 18:03               ` Carlos Munoz
2006-03-10 18:33                 ` linux-os (Dick Johnson)
2006-03-10 18:33                   ` linux-os (Dick Johnson)
2006-03-10 18:41                   ` Ben Slusky
2006-03-10 19:18                 ` Al Viro
2006-03-10 20:04                   ` Carlos Munoz
2006-03-10 11:55             ` James Courtier-Dutton
2006-03-10 10:18         ` Jes Sorensen
2006-03-10 18:07           ` Carlos Munoz
2006-03-10  8:01       ` Arjan van de Ven
2006-03-10  2:02 ` Lee Revell
     [not found] <5OEVB-3GX-15@gated-at.bofh.it>
2006-03-10  2:32 ` Robert Hancock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44115D62.6000100@etpmod.phys.tue.nl \
    --to=bart@etpmod.phys.tue.nl \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=carlos@kenati.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlrevell@joe-job.com \
    --cc=vda@ilport.com.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.