<?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: Converting binary to signed decimal in Actionscript</title>
	<atom:link href="http://www.wirelust.com/2009/04/08/converting-binary-to-signed-decimal-in-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wirelust.com/2009/04/08/converting-binary-to-signed-decimal-in-actionscript/</link>
	<description>Technology and stuff, you know.</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:14:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Tea</title>
		<link>http://www.wirelust.com/2009/04/08/converting-binary-to-signed-decimal-in-actionscript/comment-page-1/#comment-9192</link>
		<dc:creator>Tea</dc:creator>
		<pubDate>Thu, 11 Feb 2010 16:35:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.wirelust.com/?p=157#comment-9192</guid>
		<description>um.  this particular example deals with 16bit numbers so they have a maximum value of 65,535.

You could do this with a 32 bit number: 

var hexValue:int = 0x800206A0

var unsignedValue:Number = (hexValue &amp; 0x7FFFFFFF);  
// unsignedValue now equals 132,768
 
var signedValue:Number = unsignedValue;
 
// if the signed flag is set, flip the value
if ((hexValue &gt;&gt; 31) == 1) {
    signedValue = unsignedValue - 0x80000000;
}</description>
		<content:encoded><![CDATA[<p>um.  this particular example deals with 16bit numbers so they have a maximum value of 65,535.</p>
<p>You could do this with a 32 bit number: </p>
<p>var hexValue:int = 0x800206A0</p>
<p>var unsignedValue:Number = (hexValue &#038; 0x7FFFFFFF);<br />
// unsignedValue now equals 132,768</p>
<p>var signedValue:Number = unsignedValue;</p>
<p>// if the signed flag is set, flip the value<br />
if ((hexValue >> 31) == 1) {<br />
    signedValue = unsignedValue &#8211; 0&#215;80000000;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.wirelust.com/2009/04/08/converting-binary-to-signed-decimal-in-actionscript/comment-page-1/#comment-9187</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 11 Feb 2010 16:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.wirelust.com/?p=157#comment-9187</guid>
		<description>this doesn&#039;t work for example for a value like -132768
-132768 should become -1696 not 31072
shouldn&#039;t the line:
if ((hexValue &gt;&gt; 15) == 1)
be:
if (((hexValue &gt;&gt; 15) &amp; 1) == 1)
???
correct me if I&#039;m wrong...</description>
		<content:encoded><![CDATA[<p>this doesn&#8217;t work for example for a value like -132768<br />
-132768 should become -1696 not 31072<br />
shouldn&#8217;t the line:<br />
if ((hexValue &gt;&gt; 15) == 1)<br />
be:<br />
if (((hexValue &gt;&gt; 15) &amp; 1) == 1)<br />
???<br />
correct me if I&#8217;m wrong&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

