fix instruction positioning

use at as at and only compute difference when needed (to determine if
there is a jump in binary)
Easier to understand that way
This commit is contained in:
Torsten Ruger
2018-05-11 18:36:45 +03:00
parent bc1e29e4f6
commit 776a97986d
14 changed files with 60 additions and 29 deletions

View File

@ -17,14 +17,16 @@ module Parfait
end
def extend_to(total_size)
if total_size > self.data_length
unless @next
@next = BinaryCode.new(1)
#puts "extending #{total_size - data_length} in #{self}"
Risc::Position.reset(self) if Risc::Position.set?(self)
end
extend_one unless @next
@next.extend_to(total_size - data_length)
end
end
def extend_one
@next = BinaryCode.new(1)
#puts "extending #{total_size - data_length} in #{self}"
Risc::Position.reset(self) if Risc::Position.set?(self)
end
def to_s
"BinaryCode #{Risc::Position.set?(self) ? Risc::Position.get(self): self.object_id.to_s(16)}"
end