common: fixups

This commit is contained in:
Felix Lange 2018-06-14 11:13:37 +02:00
parent 35214d8dec
commit f1ec95b87b
4 changed files with 7 additions and 8 deletions

View file

@ -39,7 +39,7 @@ import (
const uintBits = 32 << (uint64(^uint(0)) >> 63) const uintBits = 32 << (uint64(^uint(0)) >> 63)
// Variables that specify custom error messages. // Errors
var ( var (
ErrEmptyString = &decError{"empty hex string"} ErrEmptyString = &decError{"empty hex string"}
ErrSyntax = &decError{"invalid hex string"} ErrSyntax = &decError{"invalid hex string"}

View file

@ -22,14 +22,13 @@ import (
"math/big" "math/big"
) )
// Variables allocated a new Int set used to find complement numbers // Various big integer limit values.
// and bound maximum byte lengths.
var ( var (
tt255 = BigPow(2, 255) tt255 = BigPow(2, 255)
tt256 = BigPow(2, 256) tt256 = BigPow(2, 256)
tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1)) tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1))
MaxBig256 = new(big.Int).Set(tt256m1)
tt63 = BigPow(2, 63) tt63 = BigPow(2, 63)
MaxBig256 = new(big.Int).Set(tt256m1)
MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1)) MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1))
) )

View file

@ -23,10 +23,10 @@ import (
"github.com/aristanetworks/goarista/monotime" "github.com/aristanetworks/goarista/monotime"
) )
// AbsTime will convert an integer number of units to a Duration in hours. // AbsTime represents absolute monotonic time.
type AbsTime time.Duration // absolute monotonic time type AbsTime time.Duration
// Now returns the current time, as a Duration, in nanoseconds from a monotonic clock // Now returns the current absolute monotonic time.
func Now() AbsTime { func Now() AbsTime {
return AbsTime(monotime.Now()) return AbsTime(monotime.Now())
} }

View file

@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/crypto/sha3"
) )
// Const expresses the required byte length for hashes and addresses. // Lengths of hashes and addresses in bytes.
const ( const (
HashLength = 32 HashLength = 32
AddressLength = 20 AddressLength = 20