Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 May 2016 23:24:07 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        cem@freebsd.org
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r299751 - head/sys/dev/bwn
Message-ID:  <CAJ-Vmon=qHF1douGSVd75Z7vAumAYCZOB-VcFxMum9tUk63URg@mail.gmail.com>
In-Reply-To: <CAG6CVpXZgaykWX54nUnp2UVPqGj=fnS0sMc9adAdT1FH8rZEhw@mail.gmail.com>
References:  <201605141952.u4EJq4jP017501@repo.freebsd.org> <CAG6CVpXZgaykWX54nUnp2UVPqGj=fnS0sMc9adAdT1FH8rZEhw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 14 May 2016 at 18:33, Conrad Meyer <cem@freebsd.org> wrote:
> On Sat, May 14, 2016 at 12:52 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>> Author: adrian
>> Date: Sat May 14 19:52:04 2016
>> New Revision: 299751
>> URL: https://svnweb.freebsd.org/changeset/base/299751
>>
>> Log:
>>   [bwn] migrate sqrt and add another couple of util routines.
>>
>> ...
>>
>> +unsigned int
>> +bwn_sqrt(struct bwn_mac *mac, unsigned int x)
>> +{
>> +       /* Table holding (10 * sqrt(x)) for x between 1 and 256. */
>> +       static uint8_t sqrt_table[256] = {
>> +               10, 14, 17, 20, 22, 24, 26, 28,
>> ...
>> +       };
>> +
>> +       if (x == 0)
>> +               return (0);
>> +       if (x >= 256) {
>> +               unsigned int tmp;
>> +
>> +               for (tmp = 0; x >= (2 * tmp) + 1; x -= (2 * tmp++) + 1)
>> +                       /* do nothing */ ;
>> +               return (tmp);
>
> Does this approximation method have a name?

"whatever the broadcom driver requires".

>> +       }
>> +       return (sqrt_table[x - 1] / 10);
>
> Why do we store the table as 10*sqrt() if we're just going to divide
> every entry by ten?

no idea, I just shuffled the code around so newer PHY code can use it!


-a



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmon=qHF1douGSVd75Z7vAumAYCZOB-VcFxMum9tUk63URg>