summaryrefslogtreecommitdiffstats
path: root/2/6.c
diff options
context:
space:
mode:
Diffstat (limited to '2/6.c')
-rw-r--r--2/6.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/2/6.c b/2/6.c
index 67d7c09..a8f2120 100644
--- a/2/6.c
+++ b/2/6.c
@@ -19,16 +19,16 @@ int main(int argc, char *argv[]) {
unsigned setbits(unsigned x, int p, int n, unsigned y) {
unsigned yLO, yLOA, xUnset, xPrime;
- // extract LO n bits from y
+ // extract n LO bits from y
yLO = y & ~(~0 << n);
- // align extracted LO bits of y to position p:
+ // align extracted bits to p:
yLOA = yLO << (p + 1 - n);
- // create mask with n bits from position p unset:
+ // mask with n bits from p unset:
xUnset = (~0 << p) | ~(~0 << (p - n));
- // mask out n bits from x starting at position p:
+ // mask out n bits in x from p:
xPrime = x & xUnset;
return xPrime | yLOA;