Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
int f(int x) {
if (x == 0)
return 0;
int sign = x < 0 ? -1 : 1;
return ((x&1) ? -x : +x) - sign;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.