diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-11-29 22:22:53 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-11-29 22:22:53 +0800 |
| commit | 1c86ec65de96f50a3f7b38c08e3bffe1dd81083f (patch) | |
| tree | a67612fdfbf4cc2e938787ef6f6b47251baf7cb5 /2/6.c | |
| parent | 5bde5a8dc109a0e3f8a3e31b7ffb4bd0894bef57 (diff) | |
| download | k&r-exercises-1c86ec65de96f50a3f7b38c08e3bffe1dd81083f.tar.gz | |
2.6
Diffstat (limited to '2/6.c')
| -rw-r--r-- | 2/6.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |
