Commit Diff


commit - ece643e6eb497fb87bb09907b5f0410631a60213
commit + 4731e82242fc33696c98d8788691e6fa3c732340
blob - 4133151b2cb374a2099bba81f750850506a55ab2
blob + 345951141c345c2a16c1ce2914f3d6f8be405290
--- 2-8.c
+++ 2-8.c
@@ -50,7 +50,7 @@ unsigned invert(unsigned x, int p, int n) {
 /* rightrot(x,n): returns x rotated to the right by n bits
  */
 unsigned rightrot(unsigned x, int n) {
-	return ((x & ~(~0<<n)) << (sizeof(unsigned)*8-n)) | ((x & (~0<<n)) >> n);
+	return ((x & ~(~0<<n)) << (sizeof(unsigned)*8-n)) | (x >> n);
 }
 
 /*