Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix pushliteral opcodes for negative values.

  • Loading branch information...
commit 9e6f833cd8231385dc95e3ae54cbedcdb4143791 1 parent 7bae041
Peter Zotov authored April 08, 2012
2  lib/furnace-avm2/abc/opcodes/push_literal/as3_pushbyte.rb
@@ -3,7 +3,7 @@ class AS3PushByte < PushLiteralOpcode
3 3
     instruction 0x24
4 4
 
5 5
     body do
6  
-      uint8 :value
  6
+      int8 :value
7 7
     end
8 8
 
9 9
     type :integer
2  lib/furnace-avm2/abc/opcodes/push_literal/as3_pushshort.rb
@@ -3,7 +3,7 @@ class AS3PushShort < PushLiteralOpcode
3 3
     instruction 0x25
4 4
 
5 5
     body do
6  
-      vuint30 :value
  6
+      vint32 :value
7 7
     end
8 8
 
9 9
     type :integer
14  lib/furnace-avm2/binary/record.rb
@@ -186,6 +186,20 @@ def length_uint8(value, options)
186 186
       1
187 187
     end
188 188
 
  189
+    # int8
  190
+
  191
+    def read_int8(io, options)
  192
+      io.read(1).unpack("c").at(0)
  193
+    end
  194
+
  195
+    def write_int8(io, value, options)
  196
+      io.write([value].pack("c"))
  197
+    end
  198
+
  199
+    def length_int8(value, options)
  200
+      1
  201
+    end
  202
+
189 203
     # uint16
190 204
 
191 205
     def read_uint16(io, options)
2  test/basic.as
... ...
@@ -1,7 +1,7 @@
1 1
 package test {
2 2
   class Literal {
3 3
     function test() {
4  
-      call(1, 1, 200, 200);
  4
+      call(1, 1, 200, 200, -1, -50, 32767, 32768, -32760, -500000);
5 5
     }
6 6
   }
7 7
 

0 notes on commit 9e6f833

Please sign in to comment.
Something went wrong with that request. Please try again.