aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-08-19 09:46:43 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-08-19 10:16:23 +0200
commit838e336594e410898667fa06b15f1116a3b586fd (patch)
tree1520155493fabef45ab3b5d59f396c42f7968713 /pkg/csource
parent33b9e777cbaf25d5ac727783aedddb382c97338f (diff)
sys, prog: switch values to to uint64
We currently use uintptr for all values. This won't work for 32-bit archs. Moreover in some cases we use uintptr but assume that it is always 64-bits (e.g. in encodingexec). Switch everything to uint64. Update #324
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/csource.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 163a9b065..6ac5d2eba 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -259,13 +259,13 @@ func generateTestFunc(w io.Writer, opts Options, calls []string, name string) {
}
func generateCalls(exec []byte, opts Options) ([]string, int) {
- read := func() uintptr {
+ read := func() uint64 {
if len(exec) < 8 {
panic("exec program overflow")
}
v := *(*uint64)(unsafe.Pointer(&exec[0]))
exec = exec[8:]
- return uintptr(v)
+ return v
}
resultRef := func() string {
arg := read()
@@ -332,8 +332,8 @@ loop:
case prog.ExecArgCsumInet:
fmt.Fprintf(w, "\tstruct csum_inet csum_%d;\n", n)
fmt.Fprintf(w, "\tcsum_inet_init(&csum_%d);\n", n)
- csum_chunks_num := read()
- for i := uintptr(0); i < csum_chunks_num; i++ {
+ csumChunksNum := read()
+ for i := uint64(0); i < csumChunksNum; i++ {
chunk_kind := read()
chunk_value := read()
chunk_size := read()
@@ -383,7 +383,7 @@ loop:
}
}
nargs := read()
- for i := uintptr(0); i < nargs; i++ {
+ for i := uint64(0); i < nargs; i++ {
typ := read()
size := read()
_ = size