From 64a433fd15b7fbf6e5e410548d29239ed028a9b5 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 6 Sep 2014 22:38:32 +0300 Subject: [PATCH] move the 2 to pad_to (from each call) --- lib/register/assembler.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/register/assembler.rb b/lib/register/assembler.rb index 0ec08e77..0048ebed 100644 --- a/lib/register/assembler.rb +++ b/lib/register/assembler.rb @@ -90,7 +90,7 @@ module Register variables.each do |var| write_ref var end - pad_to( variables.length + 2 ) + pad_to( variables.length ) slot.position end @@ -110,7 +110,7 @@ module Register array.each do |var| write_ref(var) end - pad_to( array.length + 2) + pad_to( array.length ) slot.position end @@ -162,7 +162,7 @@ module Register @stream.write_uint32( 0 ) #TODO types write_ref(slot.layout[:names]) #ref of layout # TODO the assembly may have to move to the object to be more extensible - count = 2 + count = 0 method.blocks.each do |block| block.codes.each do |code| code.assemble( @stream , self ) @@ -241,6 +241,7 @@ module Register end def pad_to length + length += length + 2 # for header, type and layout pad = padded(length) - length pad.times do @stream.write_uint32(0)