stop including padding
use it as a helper module
This commit is contained in:
@ -9,7 +9,6 @@ module Register
|
||||
# functions on the objects, but now it has gone to a visitor pattern.
|
||||
|
||||
class Assembler
|
||||
include Padding
|
||||
include Logging
|
||||
log_level :info
|
||||
|
||||
@ -261,7 +260,7 @@ module Register
|
||||
# pad_after is always in bytes and pads (writes 0's) up to the next 8 word boundary
|
||||
def pad_after length
|
||||
before = stream_position
|
||||
pad = padding_for(length) - 4 # four is for the MARKER we write
|
||||
pad = Padding.padding_for(length) - 4 # four is for the MARKER we write
|
||||
pad.times do
|
||||
@stream.write_unsigned_int_8(0)
|
||||
end
|
||||
|
@ -5,17 +5,17 @@ module Padding
|
||||
|
||||
# objects only come in lengths of multiple of 8 words / 32 bytes
|
||||
# and there is a "hidden" 1 word that is used for debug/check memory corruption
|
||||
def padded len
|
||||
def self.padded( len )
|
||||
a = 32 * (1 + (len + 3)/32 )
|
||||
#puts "#{a} for #{len}"
|
||||
a
|
||||
end
|
||||
|
||||
def padded_words words
|
||||
def self.padded_words( words )
|
||||
padded(words*4) # 4 == word length, a constant waiting for a home
|
||||
end
|
||||
|
||||
def padding_for length
|
||||
def self.padding_for( length )
|
||||
pad = padded(length) - length # for header, type
|
||||
pad
|
||||
end
|
||||
|
Reference in New Issue
Block a user