[Olsr-dev] Fixed Point Math Voodoo

Sven-Ola Tuecke (spam-protected)
Tue Feb 12 11:26:48 CET 2008


after releasing 0.5.5, it may be the right time to introduced some general

Attached you find a proposal to replace floats and doubles with integer
voodoo. Not perfect currently - but looks promising. My next step: evaluate,
if and how many CPU saving is possible (not sure currently if the effort is

@erik: while adding FPM to BMF, I stumbled over these lines:

float previousLinkEtx = 2 * INFINITE_ETX;
float bestEtx = 2 * INFINITE_ETX;

Because currenty I'm using 20 + 12 bits fixed points, all numbers only range
fom -500.000 to +500.000. May be good not to waste too much by defining INF
== 250.000. Do you think it's possible to replace that by "bestEtx = INF +
1" or so?

P.S: To our math cracks. Time to start your brace parser. I converted and
tested the voodoo lines - but there is of course lots of space for mistakes.
Please dig into this:

+#ifdef USE_FPM
+  entry->loss_link_quality = fpmdiv(
+    itofpm(entry->total_packets - entry->lost_packets),
+    olsr_cnf->lq_wsize < (2 * 4) ? itofpm(olsr_cnf->lq_wsize):

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 101-olsrd-fpm.patch.gz
Type: application/octet-stream
Size: 13499 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20080212/4134005b/attachment.obj>

More information about the Olsr-dev mailing list