aboutsummaryrefslogtreecommitdiffstats
path: root/dist/ethereum.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 23:40:26 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 23:40:26 +0800
commita1c0bb68ddd7a032843d16ed083a951588281278 (patch)
tree79ee66ec2945e1f898b79a5ce42c3a7c65e209b5 /dist/ethereum.js
parent774e9d24a14fd258bd832b10dab445ebaa792d29 (diff)
downloadgo-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar.gz
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar.bz2
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar.lz
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar.xz
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.tar.zst
go-tangerine-a1c0bb68ddd7a032843d16ed083a951588281278.zip
fixed checking first bit for parsing int output
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r--dist/ethereum.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js
index f6f2cf94a..3421f76d8 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -90,7 +90,7 @@ var setupInputTypes = function () {
/// Formats input value to byte representation of int
/// If value is negative, return it's two's complement
- /// If the value is floating point, it rounds it down
+ /// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var formatInt = function (value) {
var padding = 32 * 2;
@@ -178,12 +178,15 @@ var setupOutputTypes = function () {
var formatInt = function (value) {
// check if it's negative number
// it it is, return two's complement
- if (value.substr(0, 1).toLowerCase() === 'f') {
+ var firstBit = new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1);
+ if (firstBit === '1') {
return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);
}
return new BigNumber(value, 16);
};
+ /// Formats big right-aligned input bytes to uint
+ /// @returns right-aligned input bytes formatted to uint
var formatUInt = function (value) {
return new BigNumber(value, 16);
};