On Tue, Oct 03, 2017 at 05:05:06PM +0000, Hefty, Sean wrote: > > > > > if ((be32_to_cpu(dlid) >= > > > > > be16_to_cpu(IB_MULTICAST_LID_BASE)) || > > > > > (be32_to_cpu(slid) >= > > > > > be16_to_cpu(IB_MULTICAST_LID_BASE))) > > > > > > > > You can drop be32_to_cpu and be16_to_cpu now. > > > > The dlid is __be32 and IB_MULTICAST_LID_BASE is __be16. The direct > > > > comparison will work. > > > > > > It won't order properly for >=, the swap is still needed... > > > > Jason, > > Do you have reference for that? > > > > I tried to find any information about comparison of values from one > > endianess on machine with another endianess and didn't find anything > > relevant. > > The bytes are out of order, so the comparisons won't work. I understand it for the "manual" comparison (C-like arrays), but does it apply for the compiler-aware comparison? Both these variables are marked as __be32 for the compiler. Thanks
Attachment:
signature.asc
Description: PGP signature