function safe_add(x, y) {
    var lsw = (x & 0xFFFF) + (y & 0xFFFF),
      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 some JS interpreters.