-
-
Save lxzan/8f491e332a77ea6a049a78074799e9d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Buffer struct { | |
buf []byte | |
off int | |
lastRead int8 | |
} | |
//go:nosplit | |
func BufferReset1(b *bytes.Buffer, p []byte) { | |
buffer := (*Buffer)(unsafe.Pointer(b)) | |
buffer.off = 0 | |
} | |
//go:nosplit | |
func BufferReset2(b *bytes.Buffer, p []byte) { | |
buffer := (*Buffer)(unsafe.Pointer(b)) | |
buffer.buf = p | |
buffer.off = 0 | |
buffer.lastRead = 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment