Bitmask question

Discussion in 'C Programming' started by Patrick, Jul 19, 2007.

  1. Patrick

    Patrick Guest

    Hi

    I have a basic question concerning rotations and bitmasking.

    Assume the following code fragement.

    uint32 p_lo[] = { 0x00, 0x00};

    for (j = 0; j < 64; j++ )

    p_lo[0] <<= (j % 32);

    p_lo[1] <<= (j % 32);

    p_lo[1] |= (p_hi[0] >> (32 - (j % 32)));
    }

    I itend to do the following. In each iteration shift each element of
    the array by an amount of
    n. Additionally, the n-bits that are shifted out of each word should
    be the least significant bits of the next higher
    word. This I try to do by shifting the lower word by 32 - n positions
    to the left and OR then the result
    with the next higher word. Unfortunately the output does not make
    sense.

    Has anyone an idea what I am missing?

    Many thanks,
    Patrick
     
    Patrick, Jul 19, 2007
    #1
    1. Advertising

  2. Patrick

    Patrick Guest

    Sorry for the multiple posting, I just figured out that there is
    something wrong with the google newsgroup interface. Got access
    to a newsserver in the meantime!

    Cheers,
    Patrick
     
    Patrick, Jul 19, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rod Nibbe

    Bitmask & Graphics Question

    Rod Nibbe, Oct 26, 2004, in forum: Java
    Replies:
    2
    Views:
    1,630
    Rod Nibbe
    Oct 26, 2004
  2. Andrey Brozhko
    Replies:
    1
    Views:
    1,108
    Andrey Brozhko
    Dec 10, 2004
  3. =?iso-8859-9?Q?Tongu=E7?= Yumruk

    Bitmask representation of integers

    =?iso-8859-9?Q?Tongu=E7?= Yumruk, Oct 8, 2003, in forum: Python
    Replies:
    3
    Views:
    876
    Scott David Daniels
    Oct 8, 2003
  4. Xah Lee
    Replies:
    0
    Views:
    341
    Xah Lee
    Apr 23, 2007
  5. Patrick

    Simple Bitmask problem

    Patrick, Jul 18, 2007, in forum: C Programming
    Replies:
    4
    Views:
    749
    Thad Smith
    Jul 19, 2007
Loading...

Share This Page