<?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 for factornine weblog</title>
	<atom:link href="http://factornine.wordpress.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://factornine.wordpress.com</link>
	<description>flash actionscript blog</description>
	<pubDate>Sun, 06 Jul 2008 22:40:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
		<item>
		<title>Comment on ActionScript CodeSnippets by Jim Bumgardner</title>
		<link>http://factornine.wordpress.com/2008/06/20/actionscript-codesnippets/#comment-16</link>
		<dc:creator>Jim Bumgardner</dc:creator>
		<pubDate>Fri, 20 Jun 2008 21:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://factornine.wordpress.com/?p=22#comment-16</guid>
		<description>I used the XOR (^) operator quite a lot more back in my C programming days, since it tends to come in handy for more low-level stuff.  Not so much with Actionscript &#38; Javascript, although it still has it's uses.

Along with the other bitwise operators (&#38; and &#124;), XOR can be useful for maintaining a set of flags in a single variable, so for example:

kFlagRed = 0x01;
kFlagBlue = 0x02;
kFlagYellow = 0x04;

curFlags = 0;

curFlags &#124;= kFlagRed;    // set a flag
curFlags &#38;= ~kFlagBlue;  // clear a flag
curFlags ^= kFlagRed;    // toggle a flag

XOR has some interesting properties, which cause it to be useful for permutation.  Because of this, you will often find the XOR operator lurking deep inside encryption algorithms.

Property 1.  (A XOR B) XOR B == A

In other words, if you XOR a variable with the same constant twice, you get the original variable back.  

This property was commonly used for swapping two numbers without the need for a temporary variable.

x ^= y;
y ^= x;
x ^= y;

For integers, this has the same effect as:

tmp = x;
x = y ;
y = tmp;

But it saved a register, back when saving registers was important.

http://en.wikipedia.org/wiki/XOR_swap_algorithm

This property was also commonly used for rendering mouse pointers back in the days of black and white graphics.  You could XOR the mouse cursor
graphic on the screen, and then XOR it again to restore the original contents, without needing a temporary backup bitmap.  This technique was the
subject of a controversial software patent.

An XOR trick was used in the mid-80s to maintain a doubly-linked list using only a single pointer (whereas two pointers are normally required).  
A cute trick back in the days  when memory was far more precious (and questionable, due to code readability, even then).

http://en.wikipedia.org/wiki/XOR_linked_list

Property 2. For any unique set of numbers A,B,C...N, if you XOR each of these numbers with a constant c, the resulting set of numbers will also be unique.

If the set of numbers is continuous, and the resulting XORed numbers don't produce numbers outside of the original range, you can use this
trick to permute the order.  For example, you can XOR all the numbers from 0-255 with 0xAA to produce the same numbers, in a different ordering.</description>
		<content:encoded><![CDATA[<p>I used the XOR (^) operator quite a lot more back in my C programming days, since it tends to come in handy for more low-level stuff.  Not so much with Actionscript &amp; Javascript, although it still has it&#8217;s uses.</p>
<p>Along with the other bitwise operators (&amp; and |), XOR can be useful for maintaining a set of flags in a single variable, so for example:</p>
<p>kFlagRed = 0&#215;01;<br />
kFlagBlue = 0&#215;02;<br />
kFlagYellow = 0&#215;04;</p>
<p>curFlags = 0;</p>
<p>curFlags |= kFlagRed;    // set a flag<br />
curFlags &amp;= ~kFlagBlue;  // clear a flag<br />
curFlags ^= kFlagRed;    // toggle a flag</p>
<p>XOR has some interesting properties, which cause it to be useful for permutation.  Because of this, you will often find the XOR operator lurking deep inside encryption algorithms.</p>
<p>Property 1.  (A XOR B) XOR B == A</p>
<p>In other words, if you XOR a variable with the same constant twice, you get the original variable back.  </p>
<p>This property was commonly used for swapping two numbers without the need for a temporary variable.</p>
<p>x ^= y;<br />
y ^= x;<br />
x ^= y;</p>
<p>For integers, this has the same effect as:</p>
<p>tmp = x;<br />
x = y ;<br />
y = tmp;</p>
<p>But it saved a register, back when saving registers was important.</p>
<p><a href="http://en.wikipedia.org/wiki/XOR_swap_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/XOR_swap_algorithm</a></p>
<p>This property was also commonly used for rendering mouse pointers back in the days of black and white graphics.  You could XOR the mouse cursor<br />
graphic on the screen, and then XOR it again to restore the original contents, without needing a temporary backup bitmap.  This technique was the<br />
subject of a controversial software patent.</p>
<p>An XOR trick was used in the mid-80s to maintain a doubly-linked list using only a single pointer (whereas two pointers are normally required).<br />
A cute trick back in the days  when memory was far more precious (and questionable, due to code readability, even then).</p>
<p><a href="http://en.wikipedia.org/wiki/XOR_linked_list" rel="nofollow">http://en.wikipedia.org/wiki/XOR_linked_list</a></p>
<p>Property 2. For any unique set of numbers A,B,C&#8230;N, if you XOR each of these numbers with a constant c, the resulting set of numbers will also be unique.</p>
<p>If the set of numbers is continuous, and the resulting XORed numbers don&#8217;t produce numbers outside of the original range, you can use this<br />
trick to permute the order.  For example, you can XOR all the numbers from 0-255 with 0xAA to produce the same numbers, in a different ordering.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reflection in AS3 by Atticus</title>
		<link>http://factornine.wordpress.com/2008/05/16/as3/#comment-10</link>
		<dc:creator>Atticus</dc:creator>
		<pubDate>Tue, 27 May 2008 00:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://factornine.wordpress.com/?p=11#comment-10</guid>
		<description>And how did you used the reflection class in Papervision3d??? I need to know how this class works with Papervision!!!</description>
		<content:encoded><![CDATA[<p>And how did you used the reflection class in Papervision3d??? I need to know how this class works with Papervision!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on First Blog by russellf9</title>
		<link>http://factornine.wordpress.com/2008/01/17/first-blog/#comment-2</link>
		<dc:creator>russellf9</dc:creator>
		<pubDate>Thu, 17 Jan 2008 14:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://factornine.wordpress.com/2008/01/17/first-blog/#comment-2</guid>
		<description>hi</description>
		<content:encoded><![CDATA[<p>hi</p>
]]></content:encoded>
	</item>
</channel>
</rss>
