MCPcopy Create free account
hub / github.com/buger/jsonparser / equalStr

Function equalStr

bytes_unsafe.go:22–24  ·  view source on GitHub ↗

The reason for using *[]byte rather than []byte in parameters is an optimization. As of Go 1.6, the compiler cannot perfectly inline the function when using a non-pointer slice. That is, the non-pointer []byte parameter version is slower than if its function body is manually inlined, whereas the po

(b *[]byte, s string)

Source from the content-addressed store, hash-verified

20// TODO: Remove hack after Go 1.7 release
21//
22func equalStr(b *[]byte, s string) bool {
23 return *(*string)(unsafe.Pointer(b)) == s
24}
25
26func parseFloat(b *[]byte) (float64, error) {
27 return strconv.ParseFloat(*(*string)(unsafe.Pointer(b)), 64)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected