Example #1
0
 /**
  * {@inheritDoc}
  * @see \Mdanter\Ecc\PointInterface::cmp()
  */
 public function cmp(PointInterface $other)
 {
     if ($other->isInfinity() && $this->isInfinity()) {
         return 0;
     }
     if ($other->isInfinity() || $this->isInfinity()) {
         return 1;
     }
     $math = $this->adapter;
     $equal = $math->cmp($this->x, $other->getX()) == 0;
     $equal &= $math->cmp($this->y, $other->getY()) == 0;
     $equal &= $this->isInfinity() == $other->isInfinity();
     $equal &= $this->curve->equals($other->getCurve());
     if ($equal) {
         return 0;
     }
     return 1;
 }