countlines in go asm, v1
This commit is contained in:
commit
9384c46598
8 changed files with 250 additions and 0 deletions
14
countlines_amd64.go
Normal file
14
countlines_amd64.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue