lib/mongodb/bson/lib/bson/decimal128.js
function(left, right) {
  if (!left && !right) {
    return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
  }

  var leftHigh = left.shiftRightUnsigned(32);
  var leftLow = new Long(left.getLowBits(), 0);
  var rightHigh = right.shiftRightUnsigned(32);
  var rightLow = new Long(right.getLowBits(), 0);

  var productHigh = leftHigh.multiply(rightHigh);
  var productMid = leftHigh.multiply(rightLow);
  var productMid2 = leftLow.multiply(rightHigh);
  var productLow = leftLow.multiply(rightLow);

  productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
  productMid = new Long(productMid.getLowBits(), 0)
    .add(productMid2)
    .add(productLow.shiftRightUnsigned(32));

  productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
  productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));

  // Return the 128 bit result
  return { high: productHigh, low: productLow };
}
function(left, right) {
  if (!left && !right) {
    return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
  }

  var leftHigh = left.shiftRightUnsigned(32);
  var leftLow = new Long(left.getLowBits(), 0);
  var rightHigh = right.shiftRightUnsigned(32);
  var rightLow = new Long(right.getLowBits(), 0);

  var productHigh = leftHigh.multiply(rightHigh);
  var productMid = leftHigh.multiply(rightLow);
  var productMid2 = leftLow.multiply(rightHigh);
  var productLow = leftLow.multiply(rightLow);

  productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
  productMid = new Long(productMid.getLowBits(), 0)
    .add(productMid2)
    .add(productLow.shiftRightUnsigned(32));

  productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
  productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));

  // Return the 128 bit result
  return { high: productHigh, low: productLow };
}
function ( left , right ) { if ( ! left && ! right ) { return { high : Long . fromNumber ( 0 ) , low : Long . fromNumber ( 0 ) } ; } var leftHigh = left . shiftRightUnsigned ( 32 ) ; var leftLow = new Long ( left . getLowBits ( ) , 0 ) ; var rightHigh = right . shiftRightUnsigned ( 32 ) ; var rightLow = new Long ( right . getLowBits ( ) , 0 ) ; var productHigh = leftHigh . multiply ( rightHigh ) ; var productMid = leftHigh . multiply ( rightLow ) ; var productMid2 = leftLow . multiply ( rightHigh ) ; var productLow = leftLow . multiply ( rightLow ) ; productHigh = productHigh . add ( productMid . shiftRightUnsigned ( 32 ) ) ; productMid = new Long ( productMid . getLowBits ( ) , 0 ) . add ( productMid2 ) . add ( productLow . shiftRightUnsigned ( 32 ) ) ; productHigh = productHigh . add ( productMid . shiftRightUnsigned ( 32 ) ) ; productLow = productMid . shiftLeft ( 32 ) . add ( new Long ( productLow . getLowBits ( ) , 0 ) ) ; // Return the 128 bit result return { high : productHigh , low : productLow } ; }
Multiply two Long values and return the 128 bit value
Multiply two Long values and return the 128 bit value