| 29 | return number + ""; |
| 30 | } |
| 31 | function int64(low, hi) { |
| 32 | this.low = (low >>> 0); |
| 33 | this.hi = (hi >>> 0); |
| 34 | this.add32inplace = function (val) { |
| 35 | var new_lo = (((this.low >>> 0) + val) & 0xFFFFFFFF) >>> 0; |
| 36 | var new_hi = (this.hi >>> 0); |
| 37 | if (new_lo < this.low) |
| 38 | new_hi++; |
| 39 | this.hi = new_hi; |
| 40 | this.low = new_lo; |
| 41 | }; |
| 42 | this.add32 = function (val) { |
| 43 | var new_lo = (((this.low >>> 0) + val) & 0xFFFFFFFF) >>> 0; |
| 44 | var new_hi = (this.hi >>> 0); |
| 45 | if (new_lo < this.low) |
| 46 | new_hi++; |
| 47 | return new int64(new_lo, new_hi); |
| 48 | }; |
| 49 | this.sub32 = function (val) { |
| 50 | var new_lo = (((this.low >>> 0) - val) & 0xFFFFFFFF) >>> 0; |
| 51 | var new_hi = (this.hi >>> 0); |
| 52 | if (new_lo > (this.low) & 0xFFFFFFFF) |
| 53 | new_hi--; |
| 54 | return new int64(new_lo, new_hi); |
| 55 | }; |
| 56 | this.sub32inplace = function (val) { |
| 57 | var new_lo = (((this.low >>> 0) - val) & 0xFFFFFFFF) >>> 0; |
| 58 | var new_hi = (this.hi >>> 0); |
| 59 | if (new_lo > (this.low) & 0xFFFFFFFF) |
| 60 | new_hi--; |
| 61 | this.hi = new_hi; |
| 62 | this.low = new_lo; |
| 63 | }; |
| 64 | this.and32 = function (val) { |
| 65 | var new_lo = this.low & val; |
| 66 | var new_hi = this.hi; |
| 67 | return new int64(new_lo, new_hi); |
| 68 | }; |
| 69 | this.and64 = function (vallo, valhi) { |
| 70 | var new_lo = this.low & vallo; |
| 71 | var new_hi = this.hi & valhi; |
| 72 | return new int64(new_lo, new_hi); |
| 73 | }; |
| 74 | this.toString = function (val) { |
| 75 | val = 16; |
| 76 | var lo_str = (this.low >>> 0).toString(val); |
| 77 | var hi_str = (this.hi >>> 0).toString(val); |
| 78 | if (this.hi == 0) |
| 79 | return lo_str; |
| 80 | else |
| 81 | lo_str = zeroFill(lo_str, 8); |
| 82 | return hi_str + lo_str; |
| 83 | }; |
| 84 | this.toPacked = function () { |
| 85 | return { |
| 86 | hi: this.hi, |
| 87 | low: this.low |
| 88 | }; |