From fb394c768577b5e477443fb903bff44787cb9046 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Fri, 10 Mar 2023 11:03:04 -0800 Subject: [PATCH] reflect: add UnsafeAddr() --- src/reflect/value.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/reflect/value.go b/src/reflect/value.go index 24cbf288..41807af2 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -228,6 +228,10 @@ func (v Value) Addr() Value { } } +func (v Value) UnsafeAddr() uintptr { + return uintptr(v.Addr().UnsafePointer()) +} + func (v Value) CanSet() bool { return v.flags&(valueFlagExported|valueFlagIndirect) == valueFlagExported|valueFlagIndirect }