/** Return a new BigInt object containing the result of a logical AND operation on this BigInt and $bigint. */ public function LogicalAND(BigInt $bigint) { if ($bigint == null) { throw new Exception("Argument error :: bigint cannot be null!"); } $count = $this->width; if ($count != $bigint->Width()) { throw new Exception("Format error :: BigInts must be of equal size!"); } $bigint_arr = $bigint->ToBitArray(); $ret = $this->InitializeArray($count); for ($i = 0; $i < $count; $i++) { if ($this->bits[$i] == 1 && $bigint_arr[$i] == 1) { $ret[$i] = 1; } } return $this->ToBigInt($ret); }