mmap: use unsafe.Slice rather than maxBytes array

Fixes golang/go#49106

Change-Id: I79883a26d8c444645e86449c35e331bb749501a9
GitHub-Last-Rev: 614eef621c3dc49407f1962f4723e39910b68824
GitHub-Pull-Request: golang/exp#22
Reviewed-on: https://go-review.googlesource.com/c/exp/+/372834
Reviewed-by: Yaakov Selkowitz <yselkowi@redhat.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/mmap/mmap_windows.go b/mmap/mmap_windows.go
index a2f1158..d898828 100644
--- a/mmap/mmap_windows.go
+++ b/mmap/mmap_windows.go
@@ -108,7 +108,7 @@
 	if err != nil {
 		return nil, err
 	}
-	data := (*[maxBytes]byte)(unsafe.Pointer(ptr))[:size]
+	data := unsafe.Slice((*byte)(unsafe.Pointer(ptr)), size)
 
 	r := &ReaderAt{data: data}
 	if debug {
diff --git a/mmap/mmap_windows_386.go b/mmap/mmap_windows_386.go
deleted file mode 100644
index 26e8b7a..0000000
--- a/mmap/mmap_windows_386.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mmap
-
-const maxBytes = 1<<31 - 1
diff --git a/mmap/mmap_windows_amd64.go b/mmap/mmap_windows_amd64.go
deleted file mode 100644
index 656bedd..0000000
--- a/mmap/mmap_windows_amd64.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mmap
-
-const maxBytes = 1<<50 - 1