Created
December 25, 2015 10:24
-
-
Save klauspost/3ae5dd42dd4f53d59247 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//+build !appengine | |
package prefetch | |
func prefetchBS(b [][]byte) |
This file contains hidden or 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
// func prefetchBS(b [][]byte) | |
TEXT ·prefetchBS(SB), 7, $0 | |
MOVQ b(FP), SI // SI: &b | |
MOVQ b_len+8(FP), DX // DX: len(b) | |
TESTQ DX, DX | |
JZ end | |
loop: | |
MOVQ (SI), AX // AX: b[0] | |
PREFETCHT0 (AX) // Prefetch first entry | |
ADDQ $24, SI // Move to next entry in b | |
SUBQ $1, DX // b-- | |
JNZ loop | |
end: | |
RET |
This file contains hidden or 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
//+build !amd64 appengine | |
package prefetch | |
func prefetchBS(b [][]byte) { | |
// doest nothing on other platforms | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment