adding 64-bit integers in 16-bit pieces with JavaScript
<p>I have two objects, <code>this</code> and <code>that</code>, each with properties <code>a</code>, <code>b</code>, <code>c</code> and <code>d</code> that represent the highest, second-highest, second-lowest and lowest 16-bit pieces that represent a 64-bit unsigned integer in each.</p>

<ul>
<li>Would this be a correct way to add them, that works in all cases?</li>
<li>Is it the most efficient, or can it be improved?</li>
</ul>

<hr>

<pre><code>var a = this.a + that.a,
    b = this.b + that.b,
    c = this.c + that.c,
    d = this.d + that.d;
if (d &gt; 0xffff)
    c += d &gt;&gt; 16,
    d %= d % 0xffff;
if (c &gt; 0xffff)
    b += c &gt;&gt; 16,
    c %= 0xffff;
if (b &gt; 0xffff)
    a += b &gt;&gt; 16,
    b %= 0xffff;
if (a &gt; 0xffff)
    a %= 0xffff;
this.a = a;
this.b = b;
this.c = c;
this.d = d;
</code></pre>
