Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Fix pushliteral opcodes for negative values.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Apr 8, 2012
1 parent 7bae041 commit 9e6f833
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/furnace-avm2/abc/opcodes/push_literal/as3_pushbyte.rb
Expand Up @@ -3,7 +3,7 @@ class AS3PushByte < PushLiteralOpcode
instruction 0x24

body do
uint8 :value
int8 :value
end

type :integer
Expand Down
2 changes: 1 addition & 1 deletion lib/furnace-avm2/abc/opcodes/push_literal/as3_pushshort.rb
Expand Up @@ -3,7 +3,7 @@ class AS3PushShort < PushLiteralOpcode
instruction 0x25

body do
vuint30 :value
vint32 :value
end

type :integer
Expand Down
14 changes: 14 additions & 0 deletions lib/furnace-avm2/binary/record.rb
Expand Up @@ -186,6 +186,20 @@ def length_uint8(value, options)
1
end

# int8

def read_int8(io, options)
io.read(1).unpack("c").at(0)
end

def write_int8(io, value, options)
io.write([value].pack("c"))
end

def length_int8(value, options)
1
end

# uint16

def read_uint16(io, options)
Expand Down
2 changes: 1 addition & 1 deletion test/basic.as
@@ -1,7 +1,7 @@
package test {
class Literal {
function test() {
call(1, 1, 200, 200);
call(1, 1, 200, 200, -1, -50, 32767, 32768, -32760, -500000);
}
}

Expand Down

0 comments on commit 9e6f833

Please sign in to comment.