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

Sven Eckelmann
2011-03-18T11:18:52Z

[-- Attachment #1: Type: Text/Plain, Size: 1455 bytes --]

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

Ehrm, you know that you ignore the fact that seq_bits[i] may be 64 bits? And
you only calculate the weighted sum of a single "word" (which you static
casted to int....?) and not all words. And the sum is still wrong weighted
(you still give zero weight for the newest one and increase the weight for the
older). 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.

Sry, I have really no idea what I should say to it.

Regards,
Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]