:: Re: [DNG] Studying C as told. (For …
Top Pagina
Delete this message
Reply to this message
Auteur: Edward Bartolo
Datum:  
Aan: dng
Onderwerp: Re: [DNG] Studying C as told. (For help)
Hi,

Never mind, I understood it.

Edward

On 24/06/2016, Edward Bartolo <edbarx@???> wrote:
> 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
>