summaryrefslogtreecommitdiff
path: root/CSAPP/shift.c
diff options
context:
space:
mode:
Diffstat (limited to 'CSAPP/shift.c')
-rw-r--r--CSAPP/shift.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/CSAPP/shift.c b/CSAPP/shift.c
new file mode 100644
index 0000000..3b088cf
--- /dev/null
+++ b/CSAPP/shift.c
@@ -0,0 +1,7 @@
+long shift(long x, long n) {
+ x <<= 4;
+ x >>= n;
+ return x;
+}
+
+