Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
fc87bc5f
Commit
fc87bc5f
authored
Sep 07, 2017
by
Martin Holst Swende
Committed by
Felix Lange
Sep 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: improve documentation of Hash.SetBytes (#15062)
Fixes #15004
parent
c1740e45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
types.go
common/types.go
+2
-2
No files found.
common/types.go
View file @
fc87bc5f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment