From aae5f431cb06c49d66549b7fdf28c7fba8f0be5f Mon Sep 17 00:00:00 2001 From: Andy Li Date: Fri, 11 May 2018 11:00:40 +0800 Subject: [PATCH] use Bytes#getInt32 and BytesBuffer#addInt32 fix test for python and php targets --- hscript/Bytes.hx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hscript/Bytes.hx b/hscript/Bytes.hx index f9a43f6..00dfe3f 100644 --- a/hscript/Bytes.hx +++ b/hscript/Bytes.hx @@ -72,10 +72,7 @@ class Bytes { } function doEncodeInt(v: Int) { - bout.addByte(v & 0xFF); - bout.addByte((v >> 8) & 0xFF); - bout.addByte((v >> 16) & 0xFF); - bout.addByte(v >>> 24); + bout.addInt32(v); } function doEncodeConst( c : Const ) { @@ -107,7 +104,7 @@ class Bytes { } function doDecodeInt() { - var i = bin.get(pin) | (bin.get(pin+1) << 8) | (bin.get(pin+2) << 16) | (bin.get(pin+3) << 24); + var i = bin.getInt32(pin); pin += 4; return i; }