Revert "net/netip: use slice-to-array conversions"

This reverts commit 3dcf6e2c29f533865aad58488b60ae8d819a566e.

Reason for revert: breaks the longtest builders for x/tools

Change-Id: I6b6d5afbe46890b6a59829e3d5ab50d885661696
Reviewed-on: https://go-review.googlesource.com/c/go/+/433478
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go
index adb4117..b5d55ac 100644
--- a/src/net/netip/netip.go
+++ b/src/net/netip/netip.go
@@ -102,6 +102,18 @@
 	}
 }
 
+// ipv6Slice is like IPv6Raw, but operates on a 16-byte slice. Assumes
+// slice is 16 bytes, caller must enforce this.
+func ipv6Slice(addr []byte) Addr {
+	return Addr{
+		addr: uint128{
+			beUint64(addr[:8]),
+			beUint64(addr[8:]),
+		},
+		z: z6noz,
+	}
+}
+
 // ParseAddr parses s as an IP address, returning the result. The string
 // s can be in dotted decimal ("192.0.2.1"), IPv6 ("2001:db8::68"),
 // or IPv6 with a scoped addressing zone ("fe80::1cc0:3e8c:119f:c2e1%ens18").
@@ -333,9 +345,9 @@
 func AddrFromSlice(slice []byte) (ip Addr, ok bool) {
 	switch len(slice) {
 	case 4:
-		return AddrFrom4([4]byte(slice)), true
+		return AddrFrom4(*(*[4]byte)(slice)), true
 	case 16:
-		return AddrFrom16([16]byte(slice)), true
+		return ipv6Slice(slice), true
 	}
 	return Addr{}, false
 }
@@ -1008,10 +1020,10 @@
 		*ip = AddrFrom4(*(*[4]byte)(b))
 		return nil
 	case n == 16:
-		*ip = AddrFrom16([16]byte(b))
+		*ip = ipv6Slice(b)
 		return nil
 	case n > 16:
-		*ip = AddrFrom16([16]byte(b[:16])).WithZone(string(b[16:]))
+		*ip = ipv6Slice(b[:16]).WithZone(string(b[16:]))
 		return nil
 	}
 	return errors.New("unexpected slice size")