C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Rotate an integer Posted by AsmGuru62 on 22 May 2006 at 4:23 AM
#define ROTATE_INTEGER_R(n) n=(((n) << 31) | ((n) >> 1))

int RotateIntValue (int n, int bits)
{
  for (int i=0; i < bits; i++)
  {
    ROTATE_INTEGER_R (n);
  }
}

int a = 74843359;

RotateIntValue (a, 7);

Thread Tree
progeni Rotate an integer on 20 May 2006 at 9:32 PM
bilderbikkel Re: Rotate an integer on 21 May 2006 at 2:24 AM
IDK Re: Rotate an integer on 21 May 2006 at 8:13 AM
tsagld Re: Rotate an integer on 22 May 2006 at 1:28 AM
FDrache Re: Rotate an integer on 22 May 2006 at 3:21 AM
tsagld Re: Rotate an integer on 22 May 2006 at 3:25 AM
AsmGuru62 Re: Rotate an integer on 22 May 2006 at 4:23 AM
tsagld Nice trick, AsmGuru on 22 May 2006 at 5:10 AM
IDK Re: Rotate an integer on 22 May 2006 at 6:38 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.