<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Rotate an integer' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Rotate an integer' posted on the 'C and C++' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 21:27:18 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 21:27:18 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337493/rotate-an-integer/</link>
      <description>Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regs&lt;br /&gt;
progeni..&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337493/rotate-an-integer/</guid>
      <pubDate>Sat, 20 May 2006 21:32:24 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337499/re-rotate-an-integer/#337499</link>
      <description>Use the function 'rotate'. If you don't have it, you'll have to write it or search Google. It is too complex to explain...&lt;br /&gt;
bilderbikkel&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337499/re-rotate-an-integer/#337499</guid>
      <pubDate>Sun, 21 May 2006 02:24:51 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337514/re-rotate-an-integer/#337514</link>
      <description>: Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: Regs&lt;br /&gt;
: progeni..&lt;br /&gt;
: &lt;br /&gt;
Here's the program:&lt;br /&gt;
    ror ax, 1&lt;br /&gt;
I think it's about 2 bytes or so.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337514/re-rotate-an-integer/#337514</guid>
      <pubDate>Sun, 21 May 2006 08:13:58 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337553/re-rotate-an-integer/#337553</link>
      <description>: : Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: : Regs&lt;br /&gt;
: : progeni..&lt;br /&gt;
: : &lt;br /&gt;
: Here's the program:&lt;br /&gt;
:     ror ax, 1&lt;br /&gt;
: I think it's about 2 bytes or so.&lt;br /&gt;
: &lt;br /&gt;
That's asm. Using C++, you will need a couple of hundred lines of code. Go to your teacher and tell him that this assignment is way too complex for a beginner. Please let us know his reaction...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Greets,&lt;br /&gt;
Eric Goldstein&lt;br /&gt;
&lt;a href="http://www.gvh-maatwerk.nl"&gt;http://www.gvh-maatwerk.nl&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337553/re-rotate-an-integer/#337553</guid>
      <pubDate>Mon, 22 May 2006 01:28:49 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337560/re-rotate-an-integer/#337560</link>
      <description>: : : Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
: : Here's the program:&lt;br /&gt;
: :     ror ax, 1&lt;br /&gt;
: : I think it's about 2 bytes or so.&lt;br /&gt;
: : &lt;br /&gt;
: That's asm. Using C++, you will need a couple of hundred lines of code. &lt;br /&gt;
&lt;br /&gt;
- Here are my 100 lines. If you need left rotation, too, think of using an extra bool in the call or negative numbers for by. Sorry no indentation possible. FDrache.&lt;br /&gt;
&lt;br /&gt;
int RotateRight(int Number, short by)&lt;br /&gt;
{&lt;br /&gt;
    int  i;&lt;br /&gt;
    bool on;&lt;br /&gt;
&lt;br /&gt;
    by = By % 32; // for safety&lt;br /&gt;
&lt;br /&gt;
    for (i = 1; i &amp;lt;= by; i++)&lt;br /&gt;
    {&lt;br /&gt;
        // The LSB goes lost by shifting right&lt;br /&gt;
        on = (Number &amp;amp; 1) &amp;gt; 0; // Save LSB&lt;br /&gt;
        Number = Number &amp;gt;&amp;gt; 1;&lt;br /&gt;
        if (on) &lt;br /&gt;
            Number |= 0x80000000; // Highest Bit of 32&lt;br /&gt;
    } // for i&lt;br /&gt;
&lt;br /&gt;
    return Number;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337560/re-rotate-an-integer/#337560</guid>
      <pubDate>Mon, 22 May 2006 03:21:59 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337561/re-rotate-an-integer/#337561</link>
      <description>: : : : Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
: : : Here's the program:&lt;br /&gt;
: : :     ror ax, 1&lt;br /&gt;
: : : I think it's about 2 bytes or so.&lt;br /&gt;
: : : &lt;br /&gt;
: : That's asm. Using C++, you will need a couple of hundred lines of code. &lt;br /&gt;
: &lt;br /&gt;
: - Here are my 100 lines. If you need left rotation, too, think of using an extra bool in the call or negative numbers for by. Sorry no indentation possible. FDrache.&lt;br /&gt;
: &lt;br /&gt;
: int RotateRight(int Number, short by)&lt;br /&gt;
: {&lt;br /&gt;
:     int  i;&lt;br /&gt;
:     bool on;&lt;br /&gt;
: &lt;br /&gt;
:     by = By % 32; // for safety&lt;br /&gt;
: &lt;br /&gt;
:     for (i = 1; i &amp;lt;= by; i++)&lt;br /&gt;
:     {&lt;br /&gt;
:         // The LSB goes lost by shifting right&lt;br /&gt;
:         on = (Number &amp;amp; 1) &amp;gt; 0; // Save LSB&lt;br /&gt;
:         Number = Number &amp;gt;&amp;gt; 1;&lt;br /&gt;
:         if (on) &lt;br /&gt;
:             Number |= 0x80000000; // Highest Bit of 32&lt;br /&gt;
:     } // for i&lt;br /&gt;
: &lt;br /&gt;
:     return Number;&lt;br /&gt;
: }&lt;br /&gt;
: &lt;br /&gt;
Come on! We were making fun of the initial poster. Didn't you get that?&lt;br /&gt;
You are probably the first person here that did someone else's homework.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Greets,&lt;br /&gt;
Eric Goldstein&lt;br /&gt;
&lt;a href="http://www.gvh-maatwerk.nl"&gt;http://www.gvh-maatwerk.nl&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337561/re-rotate-an-integer/#337561</guid>
      <pubDate>Mon, 22 May 2006 03:25:37 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337569/re-rotate-an-integer/#337569</link>
      <description>&lt;pre class="sourcecode"&gt;
#define ROTATE_INTEGER_R(n) n=(((n) &amp;lt;&amp;lt; 31) | ((n) &amp;gt;&amp;gt; 1))

int RotateIntValue (int n, int bits)
{
  for (int i=0; i &amp;lt; bits; i++)
  {
    ROTATE_INTEGER_R (n);
  }
}

int a = 74843359;

RotateIntValue (a, 7);
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337569/re-rotate-an-integer/#337569</guid>
      <pubDate>Mon, 22 May 2006 04:23:27 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Nice trick, AsmGuru</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337575/nice-trick-asmguru/#337575</link>
      <description>: &lt;pre class="sourcecode"&gt;
: #define ROTATE_INTEGER_R(n) n=(((n) &amp;lt;&amp;lt; 31) | ((n) &amp;gt;&amp;gt; 1))
: &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Never saw it before.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Greets,&lt;br /&gt;
Eric Goldstein&lt;br /&gt;
&lt;a href="http://www.gvh-maatwerk.nl"&gt;http://www.gvh-maatwerk.nl&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337575/nice-trick-asmguru/#337575</guid>
      <pubDate>Mon, 22 May 2006 05:10:13 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: Rotate an integer</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/337493/337582/re-rotate-an-integer/#337582</link>
      <description>: : : Write a program to rotate an integer,m in the right hand direction ,by a specified no of bits,n. those who give the code pls explain as well.Thanks&lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : Regs&lt;br /&gt;
: : : progeni..&lt;br /&gt;
: : : &lt;br /&gt;
: : Here's the program:&lt;br /&gt;
: :     ror ax, 1&lt;br /&gt;
: : I think it's about 2 bytes or so.&lt;br /&gt;
: : &lt;br /&gt;
: That's asm. Using C++, you will need a couple of hundred lines of code. Go to your teacher and tell him that this assignment is way too complex for a beginner. Please let us know his reaction...&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: Greets,&lt;br /&gt;
: Eric Goldstein&lt;br /&gt;
: &lt;a href="http://www.gvh-maatwerk.nl"&gt;http://www.gvh-maatwerk.nl&lt;/a&gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
He didn't even say wich language to use...&lt;br /&gt;
&lt;br /&gt;
Since someone already have done the work, I can do it too...&lt;br /&gt;
Here's three lines of code that will do it:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
int i = 0;
int j = 0;
asm{
    ror [i], [j]
}
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/337493/337582/re-rotate-an-integer/#337582</guid>
      <pubDate>Mon, 22 May 2006 06:38:23 -0700</pubDate>
      <category>C and C++</category>
    </item>
  </channel>
</rss>