:: Re: [DNG] Studying C as told. (For …
Forside
Slet denne besked
Besvar denne besked
Skribent: Edward Bartolo
Dato:  
Til: dng
Emne: Re: [DNG] Studying C as told. (For help)
Bitwise Operators:

Pg 63:
/* getbits: get n bits from position p */

unigned int getbits(unsigned int x, int p, int n)
{
return (x >> (p + 1 - n)) & ~(~0 << n);
}

Why is the book using p + 1 - n?! According to my logic it should use p - 1.

Edward