mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
common: avoid allocation in isHex by iterating string bytes directly
This commit is contained in:
parent
e6d34c1fee
commit
35953f7764
1 changed files with 2 additions and 2 deletions
|
|
@ -62,8 +62,8 @@ func isHex(str string) bool {
|
|||
if len(str)%2 != 0 {
|
||||
return false
|
||||
}
|
||||
for _, c := range []byte(str) {
|
||||
if !isHexCharacter(c) {
|
||||
for i := 0; i < len(str); i++ {
|
||||
if !isHexCharacter(str[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue