Skip to content

Instantly share code, notes, and snippets.

@lsauer
Created September 6, 2011 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsauer/1197340 to your computer and use it in GitHub Desktop.
Save lsauer/1197340 to your computer and use it in GitHub Desktop.
ANSI C Determine the sign of a variable
( 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