Created
February 14, 2013 18:13
-
-
Save alberts/4954878 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
package sse42 | |
//#include <string.h> | |
//#cgo linux CFLAGS: -O3 -msse4.2 | |
import "C" | |
import "unsafe" | |
func Equal(b1, b2 []byte) bool { | |
if len(b1) != len(b2) { | |
return false | |
} | |
if len(b1) == 0 { | |
return true | |
} | |
return C.strncmp((*C.char)(unsafe.Pointer(&b1[0])), (*C.char)(unsafe.Pointer(&b2[0])), C.size_t(len(b1))) == 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment