mem_length to word/byte length

be more specific, and don’t include padding
This commit is contained in:
Torsten Ruger
2015-06-05 09:20:43 +03:00
parent 30d9aaf61b
commit 1c29fcfd43
13 changed files with 39 additions and 40 deletions

View File

@@ -41,9 +41,9 @@ module Virtual
# Code interface follows. Note position is inheitted as is from Code
# length of the Plock is the length of the block, plus the branch, plus data.
def mem_length
len = @data.inject(super) {| sum , item | sum + item.mem_length}
len + @branch_code.mem_length
def byte_length
len = @data.inject(super) {| sum , item | sum + item.word_length}
len + @branch_code.word_length
end
# again, super + branch plus data
@@ -52,7 +52,7 @@ module Virtual
@branch_code.link_at pos , context
@data.each do |code|
code.link_at(pos , context)
pos += code.mem_length
pos += code.word_length
end
end