14 lines
256 B
Go
14 lines
256 B
Go
//go:build amd64 && !gccgo && !appengine
|
|
|
|
package countlines
|
|
|
|
func CountNewlines(s []byte) uint64 {
|
|
if len(s) == 0 {
|
|
return 0
|
|
}
|
|
|
|
return countNewlinesASM(&s[0], uint64(len(s)))
|
|
}
|
|
|
|
//go:noescape
|
|
func countNewlinesASM(src *byte, len uint64) (ret uint64)
|