<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A Table of Nonnegative Powers of Two</title>
	<atom:link href="http://www.exploringbinary.com/a-table-of-nonnegative-powers-of-two/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.exploringbinary.com/a-table-of-nonnegative-powers-of-two/</link>
	<description>Binary Numbers, Binary Code, and Binary Logic</description>
	<lastBuildDate>Mon, 30 Jan 2012 01:37:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Rick Regan</title>
		<link>http://www.exploringbinary.com/a-table-of-nonnegative-powers-of-two/comment-page-1/#comment-4770</link>
		<dc:creator>Rick Regan</dc:creator>
		<pubDate>Mon, 07 Feb 2011 15:01:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.exploringbinary.com/?p=80#comment-4770</guid>
		<description>@lallehat,

My method assigns a decimal power of two from the table directly to a variable. Your method assigns a power of two indirectly through knowledge of the underlying binary representation (two&#039;s complement) and bit shifting operations. Both methods work: mine uses the &#8220;2&lt;sup&gt;n&lt;/sup&gt;&#8221; column, and yours uses the &#8220;n&#8221; column. I would think it&#039;s just a matter of personal preference as to which method you choose.

As for performance, there&#039;s no difference. Both should be resolved at compile time. For example, under Visual C++, both resolve to these two assembler statements:

&lt;pre&gt;
00419B4E  mov         dword ptr [po2],0  
00419B55  mov         dword ptr [ebp-8],80000000h
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@lallehat,</p>
<p>My method assigns a decimal power of two from the table directly to a variable. Your method assigns a power of two indirectly through knowledge of the underlying binary representation (two&#8217;s complement) and bit shifting operations. Both methods work: mine uses the &ldquo;2<sup>n</sup>&rdquo; column, and yours uses the &ldquo;n&rdquo; column. I would think it&#8217;s just a matter of personal preference as to which method you choose.</p>
<p>As for performance, there&#8217;s no difference. Both should be resolved at compile time. For example, under Visual C++, both resolve to these two assembler statements:</p>
<pre>
00419B4E  mov         dword ptr [po2],0
00419B55  mov         dword ptr [ebp-8],80000000h
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: lallehat</title>
		<link>http://www.exploringbinary.com/a-table-of-nonnegative-powers-of-two/comment-page-1/#comment-4769</link>
		<dc:creator>lallehat</dc:creator>
		<pubDate>Mon, 07 Feb 2011 14:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.exploringbinary.com/?p=80#comment-4769</guid>
		<description>[quote]
unsigned long long po2 = 9223372036854775808ULL; //2^63
[/quote]
Please don&#039;t ever do that.

Use the left shift operator (&lt;&lt;) instead, like
unsigned long long po2 = 1ULL&lt;&lt;63;</description>
		<content:encoded><![CDATA[<p>[quote]<br />
unsigned long long po2 = 9223372036854775808ULL; //2^63<br />
[/quote]<br />
Please don&#8217;t ever do that.</p>
<p>Use the left shift operator (&lt;&lt;) instead, like<br />
unsigned long long po2 = 1ULL&lt;&lt;63;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

