key = $key; $this->name = $name; $this->description = $description; $this->offset = $offset; $this->size = $size; $this->initialValue = $initialValue; $this->access = $access; $this->alternative = $alternative; $this->bitFields = $bitFields; } public function intersectsWith(Register $other): bool { $endAddress = !is_null($this->offset) && !is_null($this->size) ? ($this->offset + $this->size - 1) : null; $otherEndAddress = !is_null($other->offset) && !is_null($other->size) ? ($other->offset + $other->size - 1) : null; return $this->offset !== null && $endAddress !== null && $other->offset !== null && $otherEndAddress !== null && ( ($other->offset <= $this->offset && $otherEndAddress >= $this->offset) || ($other->offset >= $this->offset && $other->offset <= $endAddress) ) ; } }