Created
September 6, 2011 11:45
-
-
Save lsauer/1197340 to your computer and use it in GitHub Desktop.
ANSI C Determine the sign of a variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( a >= 0 && ~a >= 0 ) | |
First statement ensures that the variable is positive, the second ensures that no sign-bit is flipped. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment