Skip to content

Commit

Permalink
Added the Memory#mem64? method (closes #87).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Feb 26, 2025
1 parent 5ea3997 commit 24628e6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/ronin/asm/memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
22 changes: 22 additions & 0 deletions spec/memory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 24628e6

Please sign in to comment.