[Olsr-dev] Improving SPF with binary heaps

Diogo Gonçalves (spam-protected)
Thu Jul 30 20:54:49 CEST 2015


2015-07-30 9:32 GMT-03:00 Henning Rogge <(spam-protected)>:

> Just another thought about the code itself...
>
> any reason we could not simplify the following function to something like
> this?
>
> static unsigned int
> heap_perfect_log2 (unsigned int number) {
>     unsigned int log = 0, pow=1, original_number=number, i;
>     while (number >>= 1) ++log;
>     return original_number - (1 << log);
> }
>
>
No, the results are the same and the function looks cleaner. I will change
this function in my patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20150730/2014bc80/attachment.html>


More information about the Olsr-dev mailing list