From 2a909b0888a485d619af20b30f21fe31f0de8f6d Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 23 Mar 2025 12:02:14 +0800 Subject: Separate unsafe operations to unsafe.go --- unsafe.go | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 unsafe.go (limited to 'unsafe.go') diff --git a/unsafe.go b/unsafe.go new file mode 100644 index 0000000..4a7b2d0 --- /dev/null +++ b/unsafe.go @@ -0,0 +1,7 @@ +package main + +import "unsafe" + +func stringToBytes(s string) (bytes []byte) { + return unsafe.Slice(unsafe.StringData(s), len(s)) +} -- cgit v1.2.3