summaryrefslogtreecommitdiffstats
path: root/2
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-11-29 22:22:53 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-11-29 22:22:53 +0800
commit1c86ec65de96f50a3f7b38c08e3bffe1dd81083f (patch)
treea67612fdfbf4cc2e938787ef6f6b47251baf7cb5 /2
parent5bde5a8dc109a0e3f8a3e31b7ffb4bd0894bef57 (diff)
downloadk&r-exercises-1c86ec65de96f50a3f7b38c08e3bffe1dd81083f.tar.gz
2.6
Diffstat (limited to '2')
-rw-r--r--2/6.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/2/6.c b/2/6.c
index d311002..bf8cf2f 100644
--- a/2/6.c
+++ b/2/6.c
@@ -25,10 +25,10 @@ unsigned setbits(unsigned x, int p, int n, unsigned y) {
// align extracted bits to p:
yLOA = yLO << (p + 1 - n);
- // maks to unset n bits starting at p:
+ // mask to unset n bits starting at p:
xUnset = (~0 << p) | ~(~0 << (p - n));
- // mask out n bits in x from pth position:
+ // mask out x:
xPrime = x & xUnset;
return xPrime | yLOA;