Re: [B.A.T.M.A.N.] [PATCH 03/15] batman-adv: add biggest_unsigned_int(x) macro

Antonio Quartulli
2012-04-27T12:51:08Z

Il 25.04.2012 20:09 David Miller ha scritto:
> From: "David Laight" <David.Laight@ACULAB.COM>
> Date: Wed, 25 Apr 2012 15:57:39 +0100
>
>>
>>> > +/* Returns the biggest unsigned integer with the sizeof x */
>>> > +#define biggest_unsigned_int(x) (~(x)0)
>>>
>>> Nope - biggest_unsigned_int(unsigned char) is probably 0xffffffff
>>
>> To correct myself, it is actually ((int)(-1)) (ie a signed value).
>
> In any event this is just a terrible macro, and too stupid to live.

Hello David,

ok. So the suggestion is to directly use the ~ operator in the code
without creating a macro.
If the rest of the patchset is ok, I will eliminate this macro and
resend the pull request again.

Cheers,

--
Antonio Quartulli