summaryrefslogtreecommitdiff
path: root/3/6_control/20_op_bias.c
diff options
context:
space:
mode:
Diffstat (limited to '3/6_control/20_op_bias.c')
-rw-r--r--3/6_control/20_op_bias.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/3/6_control/20_op_bias.c b/3/6_control/20_op_bias.c
new file mode 100644
index 0000000..b071eb9
--- /dev/null
+++ b/3/6_control/20_op_bias.c
@@ -0,0 +1,10 @@
+#define OP <
+
+// x <- %rdi
+// %rbx <- 15 + (x), bias to round towards zero
+// ZF, SF <- %rdi & %rdi, check if pos or neg
+// %rbx <- x if x >= 0, set to unbiased if pos
+// %rbx <- %rbx >> 4, divide by 16
+short arith(short x) {
+ return x / 16;
+}