From 5421a08d2f924558056c8a382017ec37f56010e9 Mon Sep 17 00:00:00 2001 From: RJ Catalano Date: Tue, 27 Jun 2017 03:05:33 -0500 Subject: accounts/abi: reorganizing package with small fixes (#14610) * accounts/abi: reorganizing package and some notes and a quick correction of name. Signed-off-by: RJ Catalano get rid of some imports Signed-off-by: RJ Catalano * accounts/abi: move file names Signed-off-by: RJ Catalano * accounts/abi: fix boolean decode function Signed-off-by: RJ Catalano * accounts/abi: fix for the array set and for creating a bool Signed-off-by: RJ Catalano * accounts/abi: be very very very correct Signed-off-by: RJ Catalano * accounts/abi: fix up error message and variable names Signed-off-by: RJ Catalano * accounts/abi: take out unnecessary argument in pack method Signed-off-by: RJ Catalano * accounts/abi: add bool unpack test and add a panic to readBool function Signed-off-by: RJ Catalano * accounts/abi: fix panic message Signed-off-by: RJ Catalano * accounts/abi: change from panic to basic error Signed-off-by: RJ Catalano * accounts/abi: fix nil to false Signed-off-by: RJ Catalano * accounts/abi: fill out type regex tests and fill with the correct type for integers Signed-off-by: RJ Catalano * accounts/abi: move packNumbers into pack.go. Signed-off-by: RJ Catalano * accounts/abi: separation of the testing suite into appropriately named files. Signed-off-by: RJ Catalano * account/abi: change to hex string tests. Signed-off-by: RJ Catalano * account/abi: fix up rest of tests to hex Signed-off-by: RJ Catalano * accounts/abi: declare bool at the package level Signed-off-by: RJ Catalano * accounts/abi: use errors package in the error file. Signed-off-by: RJ Catalano * accounts/abi: fix ugly hack and fix error type declaration. Signed-off-by: RJ Catalano --- accounts/abi/numbers.go | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'accounts/abi/numbers.go') diff --git a/accounts/abi/numbers.go b/accounts/abi/numbers.go index 10afa6511..5d3efff52 100644 --- a/accounts/abi/numbers.go +++ b/accounts/abi/numbers.go @@ -62,19 +62,6 @@ func U256(n *big.Int) []byte { return math.PaddedBigBytes(math.U256(n), 32) } -// packNum packs the given number (using the reflect value) and will cast it to appropriate number representation -func packNum(value reflect.Value) []byte { - switch kind := value.Kind(); kind { - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return U256(new(big.Int).SetUint64(value.Uint())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return U256(big.NewInt(value.Int())) - case reflect.Ptr: - return U256(value.Interface().(*big.Int)) - } - return nil -} - // checks whether the given reflect value is signed. This also works for slices with a number type func isSigned(v reflect.Value) bool { switch v.Type() { -- cgit v1.2.3