aboutsummaryrefslogtreecommitdiff
path: root/unsafe.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-22 01:17:06 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-22 02:02:39 +0800
commit62045c958b0d58d61e6d22deb88eed7b9ae28a4e (patch)
tree93ae68d77f6cc21de45a9f4edbdffb6cd0b5a1ae /unsafe.go
parentUse MIT because miniirc (diff)
downloadgo-lindenii-irc-62045c958b0d58d61e6d22deb88eed7b9ae28a4e.tar.gz
go-lindenii-irc-62045c958b0d58d61e6d22deb88eed7b9ae28a4e.tar.zst
go-lindenii-irc-62045c958b0d58d61e6d22deb88eed7b9ae28a4e.zip
Basic IRCv3 message parser
Diffstat (limited to 'unsafe.go')
-rw-r--r--unsafe.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/unsafe.go b/unsafe.go
new file mode 100644
index 0000000..1c00c7b
--- /dev/null
+++ b/unsafe.go
@@ -0,0 +1,11 @@
+package irc
+
+import "unsafe"
+
+func bytesToString(bytes []byte) (s string) {
+ return unsafe.String(unsafe.SliceData(bytes), len(bytes))
+}
+
+func stringToBytes(s string) (bytes []byte) {
+ return unsafe.Slice(unsafe.StringData(s), len(s))
+}