diff --git a/lib/ronin/asm/memory.rb b/lib/ronin/asm/memory.rb index b7d0e270..1681128a 100644 --- a/lib/ronin/asm/memory.rb +++ b/lib/ronin/asm/memory.rb @@ -155,6 +155,17 @@ def mem32? @width == 4 end + # + # Determines if the operand is a 64bit memory operand. + # + # @return [Boolean] + # + # @since 1.0.0 + # + def mem64? + @width == 8 + end + # # Adds to the displacement of the Memory Operand. # diff --git a/spec/memory_spec.rb b/spec/memory_spec.rb index 1cb5d3c1..fb7932f1 100644 --- a/spec/memory_spec.rb +++ b/spec/memory_spec.rb @@ -185,6 +185,28 @@ end end + describe "#mem64?" do + context "when the #width is 8" do + let(:width) { 8 } + + subject { described_class.new(base: register, width: width) } + + it "must return true" do + expect(subject.mem64?).to be(true) + end + end + + context "when the #type is not 8" do + let(:width) { 1 } + + subject { described_class.new(base: register, width: width) } + + it "must return false" do + expect(subject.mem64?).to be(false) + end + end + end + describe "#+" do let(:operand) do described_class.new(