Skip to content

Instantly share code, notes, and snippets.

@thomwiggers
Created January 20, 2020 10:52
Show Gist options
  • Save thomwiggers/1a9d25e7703cb36e391f77fa0995a5f1 to your computer and use it in GitHub Desktop.
Save thomwiggers/1a9d25e7703cb36e391f77fa0995a5f1 to your computer and use it in GitHub Desktop.
#define int32_MINMAX(a,b) \
do { \
int32 temp1; \
asm( \
"cmpl %1,%0\n\t" \
"mov %0,%2\n\t" \
"cmovg %1,%0\n\t" \
"cmovg %2,%1\n\t" \
: "+r"(a), "+r"(b), "=r"(temp1) \
: \
: "cc" \
); \
} while(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment