Remove Padded module
Parfait was depending on it, ie it created a dependency out of Parfait. But Parfiat needs to be self contained. Moved 2 methods into parfait object, and resolved single call from text_writer to third.
This commit is contained in:
@ -1,22 +0,0 @@
|
||||
# Helper functions to pad memory.
|
||||
#
|
||||
# Meory is always in lines, chunks of 8 words / 32 bytes
|
||||
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 self.padded( len )
|
||||
a = 32 * (1 + ((len + 3)/32).floor )
|
||||
#puts "#{a} for #{len}"
|
||||
a
|
||||
end
|
||||
|
||||
def self.padded_words( words )
|
||||
padded(words*4) # 4 == word length, a constant waiting for a home
|
||||
end
|
||||
|
||||
def self.padding_for( length )
|
||||
pad = padded(length) - length # for header, type
|
||||
pad
|
||||
end
|
||||
end
|
@ -99,7 +99,7 @@ class Symbol
|
||||
l
|
||||
end
|
||||
def padded_length
|
||||
Padding.padded( to_s.length + 4)
|
||||
Parfait::Object.padded( to_s.length + 4)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -216,7 +216,7 @@ module Risc
|
||||
# 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.padding_for(length)
|
||||
pad = Parfait::Object.padded(length) - length # for header, type
|
||||
pad.times do
|
||||
@stream.write_unsigned_int_8(0)
|
||||
end
|
||||
|
Reference in New Issue
Block a user