aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/alg.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2015-11-11 12:39:30 -0500
committerMichael Matloob <matloob@golang.org>2015-11-12 17:04:45 +0000
commit432cb66f16b2bb6a167725057168bbe4aefe5fb5 (patch)
tree0a6aaf45df2810dc7276212496a4b647ed0bb6d2 /src/runtime/alg.go
parentb5a0c67fcc2f87b5e2fd04e023f9a0b2f3d759da (diff)
downloadgo-432cb66f16b2bb6a167725057168bbe4aefe5fb5.tar.gz
go-432cb66f16b2bb6a167725057168bbe4aefe5fb5.zip
runtime: break out system-specific constants into package sys
runtime/internal/sys will hold system-, architecture- and config- specific constants. Updates #11647 Change-Id: I6db29c312556087a42e8d2bdd9af40d157c56b54 Reviewed-on: https://go-review.googlesource.com/16817 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/alg.go')
-rw-r--r--src/runtime/alg.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go
index 95173495c3..9ea0eb0187 100644
--- a/src/runtime/alg.go
+++ b/src/runtime/alg.go
@@ -4,11 +4,14 @@
package runtime
-import "unsafe"
+import (
+ "runtime/internal/sys"
+ "unsafe"
+)
const (
- c0 = uintptr((8-ptrSize)/4*2860486313 + (ptrSize-4)/4*33054211828000289)
- c1 = uintptr((8-ptrSize)/4*3267000013 + (ptrSize-4)/4*23344194077549503)
+ c0 = uintptr((8-sys.PtrSize)/4*2860486313 + (sys.PtrSize-4)/4*33054211828000289)
+ c1 = uintptr((8-sys.PtrSize)/4*3267000013 + (sys.PtrSize-4)/4*23344194077549503)
)
// type algorithms - known to compiler
@@ -301,7 +304,7 @@ func memclrBytes(b []byte) {
memclr(s.array, uintptr(s.len))
}
-const hashRandomBytes = ptrSize / 4 * 64
+const hashRandomBytes = sys.PtrSize / 4 * 64
// used in asm_{386,amd64}.s to seed the hash function
var aeskeysched [hashRandomBytes]byte
@@ -324,7 +327,7 @@ func init() {
getRandomData(aeskeysched[:])
return
}
- getRandomData((*[len(hashkey) * ptrSize]byte)(unsafe.Pointer(&hashkey))[:])
+ getRandomData((*[len(hashkey) * sys.PtrSize]byte)(unsafe.Pointer(&hashkey))[:])
hashkey[0] |= 1 // make sure these numbers are odd
hashkey[1] |= 1
hashkey[2] |= 1