Converting javascript Integer to Byte array and back
<pre><code>function intFromBytes( x ){
    var val = 0;
    for (var i = 0; i &lt; x.length; ++i) {        
        val += x[i];        
        if (i &lt; x.length-1) {
            val = val &lt;&lt; 8;
        }
    }
    return val;
}

function getInt64Bytes( x ){
    var bytes = [];
    var i = 8;
    do {
    bytes[--i] = x &amp; (255);
    x = x&gt;&gt;8;
    } while ( i )
    return bytes;
}
</code></pre>

<p>I am trying to convert a javascript number to a byte array and then back to a number. However the above functions produce incorrect output with a very large number.</p>

<pre><code>var array = getInt64Bytes(23423423);    
var value = intFromBytes(array);

console.log(value); //Prints 23423423 - correct

var array = getInt64Bytes(45035996273704);  
var value = intFromBytes(array);

console.log(value); //Prints -1030792152 - incorrect
</code></pre>

<p>It is my understanding that javascript floats are 53 bits so it shouldn't be overflowing? alert(Math.pow(2,53)) works fine.</p>
