<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 3.8 &#8212; Bitwise operators</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 08:27:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Learn C++ - &#187; 14.5 &#8212; Class template specialization</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-24085</link>
		<dc:creator>Learn C++ - &#187; 14.5 &#8212; Class template specialization</dc:creator>
		<pubDate>Mon, 18 Aug 2008 03:00:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-24085</guid>
		<description>[...] how the bit-logic works in order to use the class (though here&#8217;s a link to the lesson on bitwise operators if you want to figure it out, but need a refresher on how bitwise operators [...]</description>
		<content:encoded><![CDATA[<p>[...] how the bit-logic works in order to use the class (though here&#8217;s a link to the lesson on bitwise operators if you want to figure it out, but need a refresher on how bitwise operators [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Argon</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-23495</link>
		<dc:creator>Argon</dc:creator>
		<pubDate>Wed, 13 Aug 2008 01:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-23495</guid>
		<description>Phun to look at ASCII table and how it is built up regarding bitwise operations.
I.e. Converting from upper to lower case.


A=65=01000001
a=97=01100001
&#160;&#160;32=00100000

So 65^32 (or A^32) gives 97 (or a).
So 97^32 (or a^32) gives 65 (or A).



#include &#60;iostream&#62;

int main()
{
&#160;&#160;&#160;&#160;using namespace std;
&#160;&#160;&#160;&#160;char chX,chX32;
&#160;&#160;&#160;&#160;for(int i=65;i&#60;91;i++)
&#160;&#160;&#160;&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;chX = i;
&#160;&#160;&#160;&#160;chX32 = i^32;
&#160;&#160;&#160;&#160;cout &#60;&#60; i &#60;&#60; &#34;:t&#34; &#60;&#60; chX &#60;&#60; &#34;tt&#34; &#60;&#60; int(chX32) &#60;&#60; &#34;:t&#34; &#60;&#60; chX32 &#60;&#60; &#34;tt&#34;;
&#160;&#160;&#160;&#160;chX32 = chX32^32;
&#160;&#160;&#160;&#160;cout &#60;&#60; int(chX32) &#60;&#60; &#34;:t&#34; &#60;&#60; chX32 &#60;&#60; endl;
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;return 0;
}</description>
		<content:encoded><![CDATA[<p>Phun to look at ASCII table and how it is built up regarding bitwise operations.<br />
I.e. Converting from upper to lower case.</p>
<p>A=65=01000001<br />
a=97=01100001<br />
&nbsp;&nbsp;32=00100000</p>
<p>So 65^32 (or A^32) gives 97 (or a).<br />
So 97^32 (or a^32) gives 65 (or A).</p>
<p>#include &lt;iostream&gt;</p>
<p>int main()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;using namespace std;<br />
&nbsp;&nbsp;&nbsp;&nbsp;char chX,chX32;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(int i=65;i&lt;91;i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chX = i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;chX32 = i^32;<br />
&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; i &lt;&lt; &quot;:t&quot; &lt;&lt; chX &lt;&lt; &quot;tt&quot; &lt;&lt; int(chX32) &lt;&lt; &quot;:t&quot; &lt;&lt; chX32 &lt;&lt; &quot;tt&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;chX32 = chX32^32;<br />
&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; int(chX32) &lt;&lt; &quot;:t&quot; &lt;&lt; chX32 &lt;&lt; endl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20677</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jul 2008 01:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20677</guid>
		<description>x &lt;&lt;= y is the same as x = x &lt;&lt; y.  Because of this, 3 &lt;&lt;= 1 is the same as 3 = 3 &lt;&lt; 1, which obviously makes no sense since you can't assign a value to the number 3!</description>
		<content:encoded><![CDATA[<p>x <<= y is the same as x = x << y.  Because of this, 3 <<= 1 is the same as 3 = 3 << 1, which obviously makes no sense since you can&#8217;t assign a value to the number 3!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boudiaf</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20587</link>
		<dc:creator>boudiaf</dc:creator>
		<pubDate>Wed, 09 Jul 2008 15:11:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20587</guid>
		<description>3 &#60;&#60; 1 returns 6 whereas 3 &#60;&#60;= 1 does not compile since "3" is not a variable name...

 int x = 3; x = x &#60;&#60; 1 ;  and  int x = 3 ; x &#60;&#60;= 1 ;  are equivalent; eventually x = 6.</description>
		<content:encoded><![CDATA[<p>3 &lt;&lt; 1 returns 6 whereas 3 &lt;&lt;= 1 does not compile since &#8220;3&#8243; is not a variable name&#8230;</p>
<p> int x = 3; x = x &lt;&lt; 1 ;  and  int x = 3 ; x &lt;&lt;= 1 ;  are equivalent; eventually x = 6.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moonrat</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20586</link>
		<dc:creator>moonrat</dc:creator>
		<pubDate>Wed, 09 Jul 2008 14:30:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20586</guid>
		<description>From what I understand, the end answer is the same, but in the second case the 3 itself changes to 6 (3 becomes bitwise shifted to the left 1, which is decimal 6). Whereas in the first case 3 stays 3 even after the operation; you'd need an x = 3 &#60;&#60; 1 for example for it to have any context.</description>
		<content:encoded><![CDATA[<p>From what I understand, the end answer is the same, but in the second case the 3 itself changes to 6 (3 becomes bitwise shifted to the left 1, which is decimal 6). Whereas in the first case 3 stays 3 even after the operation; you&#8217;d need an x = 3 &lt;&lt; 1 for example for it to have any context.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20065</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Sun, 29 Jun 2008 22:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-20065</guid>
		<description>What's the difference in these: 3 &#60;&#60; 1 and 3 &#60;&#60;= 1?</description>
		<content:encoded><![CDATA[<p>What&#8217;s the difference in these: 3 &lt;&lt; 1 and 3 &lt;&lt;= 1?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 3.7 &#8212; Converting between binary and decimal</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-12645</link>
		<dc:creator>Learn C++ - &#187; 3.7 &#8212; Converting between binary and decimal</dc:creator>
		<pubDate>Wed, 23 Apr 2008 02:37:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-12645</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 3.6 &#8212; Logical operators &#124; Home &#124; 3.8 &#8212; Bitwise operators &#187;     Sunday, June 17th, 2007 at 11:14 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 3.6 &#8212; Logical operators | Home | 3.8 &#8212; Bitwise operators &raquo;     Sunday, June 17th, 2007 at 11:14 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-4791</link>
		<dc:creator>Cody</dc:creator>
		<pubDate>Sat, 22 Dec 2007 15:16:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-4791</guid>
		<description>When you do the compound XOR expression the result 0101 would equal 5 not 1.

[ Fixed. -Alex ]</description>
		<content:encoded><![CDATA[<p>When you do the compound XOR expression the result 0101 would equal 5 not 1.</p>
<p>[ Fixed. -Alex ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody</title>
		<link>http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-4790</link>
		<dc:creator>Cody</dc:creator>
		<pubDate>Sat, 22 Dec 2007 15:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/#comment-4790</guid>
		<description>you put in the table that AND, OR, and XOR flip all digits in x but they do not.

[ Aah, the perils of copy and paste. :)  Fixed. -Alex ]</description>
		<content:encoded><![CDATA[<p>you put in the table that AND, OR, and XOR flip all digits in x but they do not.</p>
<p>[ Aah, the perils of copy and paste. :)  Fixed. -Alex ]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
