Christopher Smith wrote:
Gabriel Sechan wrote:
Would this be correct?
"""
#include <limits.h>
...
 if (libretval_x & INT_MAX < mysigned_x)
    do something..
"""


Platform specific- INT_MAX doesn't have to be 011111....1111. It can be all 0's, if the platform is braindead. So that's undecidable without more knowledge.
In general, with bitwise operators, you need to be sure about the bitwise layout of your types. It does seem odd to use INT_MAX instead of (~0) for a mask, but who knows what the intent is.
that was meant to be (~0>>1) of course.

--Chris

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to