On Mon, Aug 22, 2016 at 07:00:27PM +0200, Jiri Benc wrote: > While cleaning this up, you may as well take the best of both > implementations. > > On Mon, 22 Aug 2016 17:38:32 +0300, Amir Vadai wrote: > > +static inline __be64 key32_to_tunnel_id(__be32 key) > > +{ > > +#ifdef __BIG_ENDIAN > > + return (__force __be64)((__force u32)key); > > The inner cast seems to be superfluous? seems so. will check.
> > > +#else > > + return (__force __be64)((__force u64)key << 32); > > +#endif > > +} > > + > > +/* Returns the least-significant 32 bits of a __be64. */ > > +static inline __be32 tunnel_id_to_key32(__be64 x) > > Please use a more descriptive name than "x". "tunnel_id" or "tun_id" > seems to be more appropriate. ack > > > +{ > > +#ifdef __BIG_ENDIAN > > + return (__force __be32)x; > > +#else > > + return (__force __be32)((__force u64)x >> 32); > > +#endif > > +} > > Looks good otherwise. > > Thanks, > > Jiri