Skip to content

Instantly share code, notes, and snippets.

@alberts
Created February 14, 2013 18:13
Show Gist options
  • Save alberts/4954878 to your computer and use it in GitHub Desktop.
Save alberts/4954878 to your computer and use it in GitHub Desktop.
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