Thread: how do i use ROL?

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    11

    how do i use ROL?

    hi all, may i know how do i use ROL? eg,

    ROL( EA01 ∩ 1201)

    not sure how to write the code...


    i am new to C programming and quite lost with all this stuff...thanks for all your help

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I'm guessing that ROL means "rotate left" (e.g., an assembly language instruction), but ∩ means "set intersection" to me, so I do not quite understand what it means in this context. Bitwise and? It certainly is not a C operator.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    Code:
    #include <stdint.h>
    
    uint32_t rol32(uint32_t x, int32_t bits)
    {
        return x<<bits | x>>(32-bits);
    }
    I believe that function would work. If needed to be adjusted for other machine word lengths, it's pretty straightforward.
    Last edited by xuftugulus; 03-13-2008 at 09:38 AM. Reason: Sign issues should be handled by user, changed int32_t to uint32_t
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what does ROL means
    By bubblegum in forum C Programming
    Replies: 0
    Last Post: 03-08-2008, 09:20 AM
  2. Compute without Limit - support for fractions and 2G Digits!
    By etlam in forum Projects and Job Recruitment
    Replies: 14
    Last Post: 02-07-2008, 12:46 PM