function safeAdd(x, y) {
        var lsw = (x & 0xffff) + (y & 0xffff);
        var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
        return (msw << 16) | (lsw & 0xffff);
      }
Add integers, wrapping at 2^32.
This uses 16-bit operations internally to work around bugs in interpreters.

@param {number} x First integer
@param {number} y Second integer
@returns {number} Sum