[DCCP] tfrc: Fix small error in reverse lookup of p for given f(p)
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Sun, 3 Dec 2006 16:52:01 +0000 (14:52 -0200)
committerArnaldo Carvalho de Melo <acme@mandriva.com>
Sun, 3 Dec 2006 16:52:01 +0000 (14:52 -0200)
commit90fb0e60dd9178dbca2e42c682c483cdb7ea9f2d
tree09e750ded7fb3b34a0b146ef96a03a9495a9c37f
parent50ab46c790a3408c441ba4c2faa9555cacc20028
[DCCP] tfrc: Fix small error in reverse lookup of p for given f(p)

This fixes the following small error in tfrc_calc_x_reverse_lookup.

 1) The table is generated by the following equations:
lookup[index][0] = g((index+1) * 1000000/TFRC_CALC_X_ARRSIZE);
lookup[index][1] = g((index+1) * TFRC_CALC_X_SPLIT/TFRC_CALC_X_ARRSIZE);
    where g(q) is 1E6 * f(q/1E6)

 2) The reverse lookup assigns an entry in lookup[index][small]

 3) This index needs to match the above, i.e.
    * if small=0 then

       p  = (index + 1) * 1000000/TFRC_CALC_X_ARRSIZE

    * if small=1 then

p = (index+1) * TFRC_CALC_X_SPLIT/TFRC_CALC_X_ARRSIZE

These are exactly the changes that the patch makes; previously the code did
not conform to the way the lookup table was generated (this difference resulted
in a mean error of about 1.12%).

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/dccp/ccids/lib/tfrc_equation.c