Using bitwise operators in javascript
<p>I am creating a bitmask in javascript. It works fine for bit 0 through 14. When I set only bit fifteen to 1. It yields the integer value of "<code>-2147483648</code>" instead of "<code>2147483648</code>". I can do a special case hack here by returning hardcoded "<code>2147483648</code>" for bit fifteen but I would like to know the correct way of doing it.</p>

<p>Sample code:</p>

<pre><code>function join_bitmap(hex_lower_word, hex_upper_word)
{
    var lower_word = parseInt(hex_lower_word, 16);
    var upper_word = parseInt(hex_upper_word, 16);
    return (0x00000000ffffffff &amp; ((upper_word&lt;&lt;16) | lower_word));
}
</code></pre>

<p>Above code returns -2147483648 when hex_lower_word is "0x0" and hex_upper_word is "0x8000" instead of 2147483648</p>
