@@ 52-77 (lines=26) @@ | ||
49 | } |
|
50 | ||
51 | // Multiply two Long values and return the 128 bit value |
|
52 | var multiply64x2 = function(left, right) { |
|
53 | if(!left && !right) { |
|
54 | return {high: Long.fromNumber(0), low: Long.fromNumber(0)}; |
|
55 | } |
|
56 | ||
57 | var leftHigh = left.shiftRightUnsigned(32); |
|
58 | var leftLow = new Long(left.getLowBits(), 0); |
|
59 | var rightHigh = right.shiftRightUnsigned(32); |
|
60 | var rightLow = new Long(right.getLowBits(), 0); |
|
61 | ||
62 | var productHigh = leftHigh.multiply(rightHigh); |
|
63 | var productMid = leftHigh.multiply(rightLow); |
|
64 | var productMid2 = leftLow.multiply(rightHigh); |
|
65 | var productLow = leftLow.multiply(rightLow); |
|
66 | ||
67 | productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); |
|
68 | productMid = new Long(productMid.getLowBits(), 0) |
|
69 | .add(productMid2) |
|
70 | .add(productLow.shiftRightUnsigned(32)); |
|
71 | ||
72 | productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); |
|
73 | productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); |
|
74 | ||
75 | // Return the 128 bit result |
|
76 | return {high: productHigh, low: productLow}; |
|
77 | } |
|
78 | ||
79 | var lessThan = function(left, right) { |
|
80 | // Make values unsigned |
@@ 13167-13190 (lines=24) @@ | ||
13164 | }; |
|
13165 | ||
13166 | // Multiply two Long values and return the 128 bit value |
|
13167 | var multiply64x2 = function (left, right) { |
|
13168 | if (!left && !right) { |
|
13169 | return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; |
|
13170 | } |
|
13171 | ||
13172 | var leftHigh = left.shiftRightUnsigned(32); |
|
13173 | var leftLow = new Long(left.getLowBits(), 0); |
|
13174 | var rightHigh = right.shiftRightUnsigned(32); |
|
13175 | var rightLow = new Long(right.getLowBits(), 0); |
|
13176 | ||
13177 | var productHigh = leftHigh.multiply(rightHigh); |
|
13178 | var productMid = leftHigh.multiply(rightLow); |
|
13179 | var productMid2 = leftLow.multiply(rightHigh); |
|
13180 | var productLow = leftLow.multiply(rightLow); |
|
13181 | ||
13182 | productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); |
|
13183 | productMid = new Long(productMid.getLowBits(), 0).add(productMid2).add(productLow.shiftRightUnsigned(32)); |
|
13184 | ||
13185 | productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); |
|
13186 | productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); |
|
13187 | ||
13188 | // Return the 128 bit result |
|
13189 | return { high: productHigh, low: productLow }; |
|
13190 | }; |
|
13191 | ||
13192 | var lessThan = function (left, right) { |
|
13193 | // Make values unsigned |