Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Peter Zijlstra
Date: Friday, November 19, 2010 - 4:01 pm

On Fri, 2010-11-19 at 17:28 -0500, Bob Copeland wrote:

Sure, x/y := x/z * z/y, and by picking z := 2^n, we can pre-compute z/y
and write x/z using a shift. The problem however is always range vs
granularity, you chose to first /z and then *z/y, this avoids some
overflow issues but truncates the lower n bits of x.

If you first *z/y and then /z you keep your low bits but risk loosing
the top bits to an overflow.

I guess the question is do we really need weights outside of 2^n? If
not, you can use the weight := 2^n version. If you do, you get to pick
either of the previously mentioned options.

Sadly gcc doesn't sanely support a u128 type, which would be very useful
to avoid some of these overflow issues (like we used to use u64 mults
for u32 fixed points mults).
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v7 2/3] ath5k: Use generic EWMA library, Bruno Randolf, (Thu Nov 11, 8:00 pm)
[PATCH v7 3/3] nl80211/mac80211: Report signal average, Bruno Randolf, (Thu Nov 11, 8:00 pm)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Peter Zijlstra, (Fri Nov 19, 5:16 am)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Stefan Richter, (Fri Nov 19, 7:04 am)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Johannes Berg, (Fri Nov 19, 10:52 am)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Johannes Berg, (Fri Nov 19, 11:58 am)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Peter Zijlstra, (Fri Nov 19, 4:01 pm)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, Stefan Richter, (Mon Nov 22, 12:26 am)
Re: [PATCH v7 3/3] nl80211/mac80211: Report signal average, John W. Linville, (Mon Nov 22, 11:46 am)