diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 23:28:16 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 23:28:16 +0800 |
commit | d338650089d7a01983c3a853d2f917243c4de064 (patch) | |
tree | 6c7852e9e75c4ba1ff476f4c77e25adfae135e35 /common | |
parent | 20b7162a6206e61a39d799a5adf84379c9c8c818 (diff) | |
download | go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar.gz go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar.bz2 go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar.lz go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar.xz go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.tar.zst go-tangerine-d338650089d7a01983c3a853d2f917243c4de064.zip |
compilable trie (tests fail)
Diffstat (limited to 'common')
-rw-r--r-- | common/types.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/types.go b/common/types.go index e0963a7c5..1fe31657b 100644 --- a/common/types.go +++ b/common/types.go @@ -27,27 +27,27 @@ func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) } // Don't use the default 'String' method in case we want to overwrite // Get the string representation of the underlying hash -func (h Hash) Str() string { +func (h *Hash) Str() string { return string(h[:]) } // Sets the hash to the value of b. If b is larger than len(h) it will panic -func (h Hash) SetBytes(b []byte) { +func (h *Hash) SetBytes(b []byte) { if len(b) > len(h) { panic("unable to set bytes. too big") } // reverse loop - for i := len(b); i >= 0; i-- { + for i := len(b) - 1; i >= 0; i-- { h[i] = b[i] } } // Set string `s` to h. If s is larger than len(h) it will panic -func (h Hash) SetString(s string) { h.SetBytes([]byte(s)) } +func (h *Hash) SetString(s string) { h.SetBytes([]byte(s)) } // Sets h to other -func (h Hash) Set(other Hash) { +func (h *Hash) Set(other Hash) { for i, v := range other { h[i] = v } |