<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Bitwise Operators</title>
	<link>http://www.justgooddesign.com/blog/bitwise-operators.htm</link>
	<description>Just Blog</description>
	<pubDate>Fri, 30 Jul 2010 09:24:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>

	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-2916</link>
		<pubDate>Fri, 01 Jun 2007 09:19:58 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-2916</guid>
					<description>http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/</description>
		<content:encoded><![CDATA[<p><a href="http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/" rel="nofollow">http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-1643</link>
		<pubDate>Mon, 16 Apr 2007 00:40:08 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-1643</guid>
					<description>var a = false
trace( a ) // false
trace( a &#124;= 0 ) // 0
trace( a &#124;= true ) // 1
trace( a &#124;= 99 ) // 99
trace( a &#124;= true ) // 99
trace( a &#124;= 0 ) // 99</description>
		<content:encoded><![CDATA[<p>var a = false<br />
trace( a ) // false<br />
trace( a |= 0 ) // 0<br />
trace( a |= true ) // 1<br />
trace( a |= 99 ) // 99<br />
trace( a |= true ) // 99<br />
trace( a |= 0 ) // 99
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-1004</link>
		<pubDate>Sat, 17 Mar 2007 02:18:18 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-1004</guid>
					<description>One way to blindly toggle between a primary and secondary clip within an array.

var nINX = ( clips [ 0 ].isPrimary ) ? 1 : 0;
var oINX = ( nINX ^ 1 );

var primaryClip = clips[ oINX ];
var secondaryClip = clips[ nINX ];

secondaryClip.isPrimary = !( primaryClip.isPrimary = true )</description>
		<content:encoded><![CDATA[<p>One way to blindly toggle between a primary and secondary clip within an array.</p>
<p>var nINX = ( clips [ 0 ].isPrimary ) ? 1 : 0;<br />
var oINX = ( nINX ^ 1 );</p>
<p>var primaryClip = clips[ oINX ];<br />
var secondaryClip = clips[ nINX ];</p>
<p>secondaryClip.isPrimary = !( primaryClip.isPrimary = true )
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-999</link>
		<pubDate>Sat, 17 Mar 2007 02:07:20 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-999</guid>
					<description>Bitwise XOR
Bytes that differ are 1, bytes that are the same are 0. Converted to 32-bit binary integers before the operation occurs and the fractional portion of an operand, if any, is discarded.

1 = 0
0 = 1

trace ( 1^1 ) // 0
trace ( 0^1 ) // 1</description>
		<content:encoded><![CDATA[<p>Bitwise XOR<br />
Bytes that differ are 1, bytes that are the same are 0. Converted to 32-bit binary integers before the operation occurs and the fractional portion of an operand, if any, is discarded.</p>
<p>1 = 0<br />
0 = 1</p>
<p>trace ( 1^1 ) // 0<br />
trace ( 0^1 ) // 1
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-959</link>
		<pubDate>Thu, 15 Mar 2007 04:14:13 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-959</guid>
					<description>Simple way to get a gray color:

function getRandomGrayscaleColor ( ) :Number
{
	var brightness = Math.round (Math.random() * 255 );
	return getGrayscaleColor ( brightness );
}
		
function getGrayscaleColor ( brightness:Number )
{
	return ( brightness &lt;&#60;16 &#124; brightness &lt;&#60;8 &#124; brightness )
}
		
for ( var i = 0; i &lt; 100; i ++ )
{
	// new ball
	var ball = this.attachMovie( 'ball', 'ball_' + i, this.getNextHighestDepth() );
	ball._x = Stage.width * Math.random();
	ball._y = Stage.width * Math.random();

	// set color
	var colorObj:Color = new Color ( ball );
	colorObj.setRGB ( getRandomGrayscaleColor ( ) );
}</description>
		<content:encoded><![CDATA[<p>Simple way to get a gray color:</p>
<p>function getRandomGrayscaleColor ( ) :Number<br />
{<br />
	var brightness = Math.round (Math.random() * 255 );<br />
	return getGrayscaleColor ( brightness );<br />
}</p>
<p>function getGrayscaleColor ( brightness:Number )<br />
{<br />
	return ( brightness <&lt;16 | brightness <&lt;8 | brightness )<br />
}</p>
<p>for ( var i = 0; i < 100; i ++ )<br />
{<br />
	// new ball<br />
	var ball = this.attachMovie( &#8216;ball&#8217;, &#8216;ball_&#8217; + i, this.getNextHighestDepth() );<br />
	ball._x = Stage.width * Math.random();<br />
	ball._y = Stage.width * Math.random();</p>
<p>	// set color<br />
	var colorObj:Color = new Color ( ball );<br />
	colorObj.setRGB ( getRandomGrayscaleColor ( ) );<br />
}
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-958</link>
		<pubDate>Thu, 15 Mar 2007 04:00:49 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-958</guid>
					<description>Bitwise Color Creation
http://www.flash-creations.com/notes/asclass_color.php

example:
// three decimal numbers, one each for R-G-B
var nRed:Number = 101;
var nGreen:Number = 153;
var nBlue:Number = 204;
cCircle.setRGB(nRed&lt;&#60;16 &#124; nGreen&lt;&#60;8 &#124; nBlue);


see also
http://www.flash-creations.com/notes/actionscript_operators.php</description>
		<content:encoded><![CDATA[<p>Bitwise Color Creation<br />
<a href="http://www.flash-creations.com/notes/asclass_color.php" rel="nofollow">http://www.flash-creations.com/notes/asclass_color.php</a></p>
<p>example:<br />
// three decimal numbers, one each for R-G-B<br />
var nRed:Number = 101;<br />
var nGreen:Number = 153;<br />
var nBlue:Number = 204;<br />
cCircle.setRGB(nRed< &lt;16 | nGreen<&lt;8 | nBlue);</p>
<p>see also<br />
<a href="http://www.flash-creations.com/notes/actionscript_operators.php" rel="nofollow">http://www.flash-creations.com/notes/actionscript_operators.php
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-711</link>
		<pubDate>Sun, 04 Mar 2007 02:25:16 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-711</guid>
					<description>http://vijayram.wordpress.com/2007/01/30/actionscript-code-tricks-3/</description>
		<content:encoded><![CDATA[<p><a href="http://vijayram.wordpress.com/2007/01/30/actionscript-code-tricks-3/" rel="nofollow">http://vijayram.wordpress.com/2007/01/30/actionscript-code-tricks-3/</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jgraup</title>
		<link>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-710</link>
		<pubDate>Sun, 04 Mar 2007 02:23:24 +0000</pubDate>
		<guid>http://www.justgooddesign.com/blog/bitwise-operators.htm#comment-710</guid>
					<description>http://pixeldepth.net/index.php?action=tutorials&#038;category=1&#038;id=1156254799</description>
		<content:encoded><![CDATA[<p><a href="http://pixeldepth.net/index.php?action=tutorials&#038;category=1&#038;id=1156254799" rel="nofollow">http://pixeldepth.net/index.php?action=tutorials&#038;category=1&#038;id=1156254799</a>
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
