diff options
Diffstat (limited to '3/6_control/21_test_cmov.c')
| -rw-r--r-- | 3/6_control/21_test_cmov.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/3/6_control/21_test_cmov.c b/3/6_control/21_test_cmov.c new file mode 100644 index 0000000..a90d178 --- /dev/null +++ b/3/6_control/21_test_cmov.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +// Remember that jumps flip conditionals +// Also testq rdi rdi and jge test if the sign bit is set +short test(short x, short y) { + short val = 12 + y; + if (x < 0) { + if (x >= y) + val = x | y; + else + val = x * y; + } else if (y >= 10) { + val = x / y; + } + return val; +} + +int main(void) { + return 0; +} |
