Class: Udb::InstructionSubtype::Opcode
- Inherits:
-
Object
- Object
- Udb::InstructionSubtype::Opcode
- Extended by:
- T::Sig
- Defined in:
- lib/udb/obj/instruction.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
-
#initialize(name, range) ⇒ Opcode
constructor
A new instance of Opcode.
- #overlaps?(other) ⇒ Boolean
Constructor Details
#initialize(name, range) ⇒ Opcode
Returns a new instance of Opcode.
42 43 44 45 |
# File 'lib/udb/obj/instruction.rb', line 42 def initialize(name, range) @name = name @range = range end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
36 37 38 |
# File 'lib/udb/obj/instruction.rb', line 36 def name @name end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
39 40 41 |
# File 'lib/udb/obj/instruction.rb', line 39 def range @range end |
Instance Method Details
#overlaps?(other) ⇒ Boolean
48 49 50 51 52 53 54 |
# File 'lib/udb/obj/instruction.rb', line 48 def overlaps?(other) if other.is_a?(Opcode) range.eql?(other.range) || range.cover?(other.range.first) || other.range.cover?(range.first) else other.location_bits.any? { |i| range.cover?(i) } end end |