getAddressType(); if ($addressType === $to->getAddressType()) { $cmp = strcmp($from->getComparableString(), $to->getComparableString()); if ($cmp === 0) { $result = Range\Single::fromAddress($from); } else { if ($cmp > 0) { list($from, $to) = array($to, $from); } $fromBytes = $from->getBytes(); $toBytes = $to->getBytes(); $numBytes = count($fromBytes); $sameBits = 0; for ($byteIndex = 0; $byteIndex < $numBytes; ++$byteIndex) { $fromByte = $fromBytes[$byteIndex]; $toByte = $toBytes[$byteIndex]; if ($fromByte === $toByte) { $sameBits += 8; } else { $differentBitsInByte = decbin($fromByte ^ $toByte); $sameBits += 8 - strlen($differentBitsInByte); break; } } $result = static::rangeFromString($from->toString(true).'/'.(string) $sameBits); } } } return $result; } }