style: add doc comments for exported hash and utils functions
Fix revive lint warnings for FNV64a, FNV64aBytes, BytesContainsFold.
This commit is contained in:
parent
2be6b67d0b
commit
31faf77fcc
@ -1,5 +1,6 @@
|
|||||||
package hash
|
package hash
|
||||||
|
|
||||||
|
// FNV64a computes FNV-1a hash without allocation.
|
||||||
func FNV64a(key string) uint64 {
|
func FNV64a(key string) uint64 {
|
||||||
var h uint64 = 14695981039346656037
|
var h uint64 = 14695981039346656037
|
||||||
for i := 0; i < len(key); i++ {
|
for i := 0; i < len(key); i++ {
|
||||||
@ -9,6 +10,7 @@ func FNV64a(key string) uint64 {
|
|||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FNV64aBytes computes FNV-1a hash from byte slice without allocation.
|
||||||
func FNV64aBytes(key []byte) uint64 {
|
func FNV64aBytes(key []byte) uint64 {
|
||||||
var h uint64 = 14695981039346656037
|
var h uint64 = 14695981039346656037
|
||||||
for i := 0; i < len(key); i++ {
|
for i := 0; i < len(key); i++ {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ func S2b(s string) []byte {
|
|||||||
return unsafe.Slice(unsafe.StringData(s), len(s))
|
return unsafe.Slice(unsafe.StringData(s), len(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BytesContainsFold reports whether b contains subslice, case-insensitively.
|
||||||
func BytesContainsFold(b, sub []byte) bool {
|
func BytesContainsFold(b, sub []byte) bool {
|
||||||
if len(sub) == 0 {
|
if len(sub) == 0 {
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user