Skip to content

Commit

Permalink
fixed int32 overflow on php and python
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Mar 1, 2015
1 parent 2f2fc3c commit b6deed8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions std/haxe/io/Bytes.hx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ class Bytes {
public inline function getInt32( pos : Int ) : Int {
#if neko_v21
return untyped $sget32(b, pos, false);
#elseif (php || python)
var v = get(pos) | (get(pos + 1) << 8) | (get(pos + 2) << 16) | (get(pos+3) << 24);
return if( v & 0x80000000 != 0 ) v | 0x80000000 else v;
#else
return get(pos) | (get(pos + 1) << 8) | (get(pos + 2) << 16) | (get(pos+3) << 24);
#end
Expand Down

0 comments on commit b6deed8

Please sign in to comment.