Changes Read to receive uint64 byte count. (#2085)

Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
This commit is contained in:
Nuno Cruces
2024-02-28 23:58:53 +00:00
committed by GitHub
parent ba569623fc
commit 8a61b01faf
24 changed files with 82 additions and 83 deletions

View File

@@ -91,7 +91,7 @@ func main() {
defer deallocate.Call(ctx, uint64(greetingPtr), uint64(greetingSize))
// The pointer is a linear memory offset, which is where we write the name.
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
log.Panicf("Memory.Read(%d, %d) out of range of memory size %d",
greetingPtr, greetingSize, mod.Memory().Size())
} else {
@@ -100,7 +100,7 @@ func main() {
}
func logString(ctx context.Context, m api.Module, offset, byteCount uint32) {
buf, ok := m.Memory().Read(offset, byteCount)
buf, ok := m.Memory().Read(offset, uint64(byteCount))
if !ok {
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
}

View File

@@ -106,7 +106,7 @@ func main() {
}
// The pointer is a linear memory offset, which is where we write the name.
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
log.Panicf("Memory.Read(%d, %d) out of range of memory size %d",
greetingPtr, greetingSize, mod.Memory().Size())
} else {
@@ -115,7 +115,7 @@ func main() {
}
func logString(_ context.Context, m api.Module, offset, byteCount uint32) {
buf, ok := m.Memory().Read(offset, byteCount)
buf, ok := m.Memory().Read(offset, uint64(byteCount))
if !ok {
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
}

View File

@@ -98,7 +98,7 @@ func run() error {
greetingPtr := uint32(ptrSize[0] >> 32)
greetingSize := uint32(ptrSize[0])
// The pointer is a linear memory offset, which is where we write the name.
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
return fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d",
greetingPtr, greetingSize, mod.Memory().Size())
} else {
@@ -109,7 +109,7 @@ func run() error {
}
func logString(_ context.Context, m api.Module, offset, byteCount uint32) {
buf, ok := m.Memory().Read(offset, byteCount)
buf, ok := m.Memory().Read(offset, uint64(byteCount))
if !ok {
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
}