From 23c41a1ef2157da8df646a78f93d9b6e39a85a87 Mon Sep 17 00:00:00 2001 From: Graham Miller Date: Thu, 4 Nov 2010 13:45:18 -0700 Subject: [PATCH] Small addition to previous optimization of memequal as discussed here: http://groups.google.com/group/golang-nuts/browse_thread/thread/f591ba36d83723c0/9aba02d344045f38 R=golang-dev, r, r2 CC=golang-dev https://golang.org/cl/2880041 --- src/pkg/runtime/runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index 0b19e108ed..f2b6c587e9 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -320,6 +320,8 @@ memequal(uint32 s, void *a, void *b) { byte *ba, *bb, *aend; + if(a == b) + return 1; ba = a; bb = b; aend = ba+s;