int.Sign() in go will never return negative for zero.

So remove the -0 handling in fromInt, only toInt needs it.
This commit is contained in:
Owain G. Ainsworth 2013-06-19 00:50:18 +01:00
parent 5e82baf476
commit 501b711301
2 changed files with 2 additions and 7 deletions

View file

@ -51,11 +51,6 @@ func fromInt(v *big.Int) []byte {
// Int.Bytes() trims leading zeros for us, so we don't have to.
b := v.Bytes()
if len(b) == 0 {
// negative 0
if negative {
return []byte{0x80}
}
// normal 0
return []byte{}
}
arr := make([]byte, len(b))

View file

@ -118,8 +118,8 @@ github.com/conformal/btcscript/opcode.go opcodeCheckSig 96.15% (25/26)
github.com/conformal/btcscript/script.go NewScript 95.24% (20/21)
github.com/conformal/btcscript/address.go ScriptToAddress 94.92% (56/59)
github.com/conformal/btcscript/script.go parseScript 93.75% (30/32)
github.com/conformal/btcscript/stack.go fromInt 92.86% (13/14)
github.com/conformal/btcscript/script.go Script.Step 89.19% (33/37)
github.com/conformal/btcscript/stack.go fromInt 87.50% (14/16)
github.com/conformal/btcscript/script.go typeOfScript 83.33% (5/6)
github.com/conformal/btcscript/opcode.go parsedOpcode.exec 80.00% (4/5)
github.com/conformal/btcscript/script.go Script.DisasmScript 80.00% (4/5)
@ -135,5 +135,5 @@ github.com/conformal/btcscript/script.go Script.validPC 60.00% (3/5)
github.com/conformal/btcscript/script.go Script.Execute 44.44% (8/18)
github.com/conformal/btcscript/log.go SetLogWriter 0.00% (0/7)
github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1)
github.com/conformal/btcscript -------------------------- 92.99% (836/899)
github.com/conformal/btcscript -------------------------- 93.09% (835/897)