Re: [B.A.T.M.A.N.] BATMAN routing

hlabishi kobo
2011-03-21T22:40:57Z

On 3/18/11, Sven Eckelmann <sven@narfation.org> wrote:
> On Thursday 17 March 2011 23:40:06 hlabishi kobo wrote:
>> Hi thank you very much for your suggestions Sven, they were really
>> helpful. i actually now put the below code down which i am still busy
>> trying to test it.
>>
>> int weighted_bit_packet_count(TYPE_OF_WORD *seq_bits)
>> {
>> int i,check, count = 0;
>> int j;
>> //TYPE_OF_WORD *word;
>> int word;
>>
>> for (i = 0; i < NUM_WORDS; i++) {
>> word = seq_bits[i];
>>
>> for (j = 0; j < 32; j++){
>> check = (word & (1 << j)) >> j;
>> if (check == 1)
>> count += j;
>> }
>> printk("our count is %d\n", count);
>> return count;
>> }
>> //printk("our count is %d\n", count);
>> //return count;
>> }
>> When i am using it on two PC's my ping seems to be recording much
>> delay. I will appreciate your feedback in this regard.
>> Thank you and kind Regards
>

Thank you very much Sven. Your feedback have been really helpful.

> Ehrm, you know that you ignore the fact that seq_bits[i] may be 64 bits?
I actually printed the seq_bits[i] and that is basically why i used 32
but that was just for debugging purpose. But actually if i use
NUM_WORDS, my weighted sum become very small whereas if i use 32 it
becomes very big, trying to understand what might be causing it to be
that way.
And
> you only calculate the weighted sum of a single "word" (which you static
> casted to int....?) and not all words.
i actually dont understand this very well, how many words does seq_bits[i] have?
And the sum is still wrong weighted
> (you still give zero weight for the newest one and increase the weight for the older).
Thanks for letting alerting me about this, i hv now changed from
ascending to descending order.
And the way you check the bits is even for a sequential
> implementation
> overly complex. And it is normal that printk heavily increase the amount of
> time... maybe you meant that by delay.
even if i comment out the printk() statement its still carries with the delay.
> Sry, I have really no idea what I should say to it.
>
> Regards,
> Sven
>

Kind Regards
Hlabishi