diff options
author | Martin Holst Swende <martin@swende.se> | 2017-09-08 05:32:59 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-09-08 05:32:59 +0800 |
commit | fc87bc5f523ad78974e0a6ce1c5651b98a1e8a52 (patch) | |
tree | 688141c30623c3afe51e5f7e73b648f0f1794bb2 /common | |
parent | c1740e454015e61e8207cdeb34c48eee3adbb4d3 (diff) | |
download | go-tangerine-fc87bc5f523ad78974e0a6ce1c5651b98a1e8a52.tar.gz go-tangerine-fc87bc5f523ad78974e0a6ce1c5651b98a1e8a52.tar.zst go-tangerine-fc87bc5f523ad78974e0a6ce1c5651b98a1e8a52.zip |
common: improve documentation of Hash.SetBytes (#15062)
Fixes #15004
Diffstat (limited to 'common')
-rw-r--r-- | common/types.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/types.go b/common/types.go index eaf8352fb..d31bbf741 100644 --- a/common/types.go +++ b/common/types.go @@ -88,7 +88,7 @@ func (h Hash) MarshalText() ([]byte, error) { return hexutil.Bytes(h[:]).MarshalText() } -// Sets the hash to the value of b. If b is larger than len(h) it will panic +// Sets the hash to the value of b. If b is larger than len(h), 'b' will be cropped (from the left). func (h *Hash) SetBytes(b []byte) { if len(b) > len(h) { b = b[len(b)-HashLength:] @@ -97,7 +97,7 @@ func (h *Hash) SetBytes(b []byte) { copy(h[HashLength-len(b):], b) } -// Set string `s` to h. If s is larger than len(h) it will panic +// Set string `s` to h. If s is larger than len(h) s will be cropped (from left) to fit. func (h *Hash) SetString(s string) { h.SetBytes([]byte(s)) } // Sets h to other |