From 68f91aea57a81bdaab9da045c5ff09cc825da857 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 20 Aug 2014 14:02:11 -0700 Subject: [PATCH] runtime: convert memclrBytes to Go LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/131980043 --- src/pkg/runtime/alg.go | 6 ++++++ src/pkg/runtime/alg.goc | 5 ----- src/pkg/runtime/export_test.go | 5 +---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/pkg/runtime/alg.go b/src/pkg/runtime/alg.go index 650f6849501..ff296b692e9 100644 --- a/src/pkg/runtime/alg.go +++ b/src/pkg/runtime/alg.go @@ -273,3 +273,9 @@ func ifaceHash(i interface { }, seed uintptr) uintptr { return goalg(&algarray[alg_INTER]).hash(noescape(unsafe.Pointer(&i)), unsafe.Sizeof(i), seed) } + +// Testing adapter for memclr +func memclrBytes(b []byte) { + s := (*sliceStruct)(unsafe.Pointer(&b)) + memclr(s.array, uintptr(s.len)) +} diff --git a/src/pkg/runtime/alg.goc b/src/pkg/runtime/alg.goc index f9e88929291..aa0c79d4763 100644 --- a/src/pkg/runtime/alg.goc +++ b/src/pkg/runtime/alg.goc @@ -287,8 +287,3 @@ runtime·hashinit(void) } } } - -// Testing adapter for memclr -func memclrBytes(s Slice) { - runtime·memclr(s.array, s.len); -} diff --git a/src/pkg/runtime/export_test.go b/src/pkg/runtime/export_test.go index 32c34aade61..adbc1e99552 100644 --- a/src/pkg/runtime/export_test.go +++ b/src/pkg/runtime/export_test.go @@ -78,13 +78,10 @@ var Int32Hash = int32Hash var Int64Hash = int64Hash var EfaceHash = efaceHash var IfaceHash = ifaceHash +var MemclrBytes = memclrBytes var HashLoad = &hashLoad -func memclrBytes(b []byte) - -var MemclrBytes = memclrBytes - func gogoBytes() int32 var GogoBytes = gogoBytes