From e111b489ec0495a9c1097f11364f44d607da41c0 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Tue, 26 May 2026 13:45:18 -0700 Subject: [PATCH] reflect: add (u)int -> string conversions --- src/internal/reflectlite/value.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/internal/reflectlite/value.go b/src/internal/reflectlite/value.go index c3df0992d..c4fcb5956 100644 --- a/src/internal/reflectlite/value.go +++ b/src/internal/reflectlite/value.go @@ -1686,12 +1686,25 @@ func makeComplex(flags valueFlags, f complex128, t *RawType) Value { return v } -func cvtIntString(src Value, t *RawType) Value { - panic("cvtUintString: unimplemented") +//go:linkname stringFromUnicode runtime.stringFromUnicode +func stringFromUnicode(x rune) string + +func cvtIntString(v Value, t *RawType) Value { + b := stringFromUnicode(rune(v.Int())) + return Value{ + typecode: t, + value: unsafe.Pointer(&b), + flags: v.flags, + } } -func cvtUintString(src Value, t *RawType) Value { - panic("cvtUintString: unimplemented") +func cvtUintString(v Value, t *RawType) Value { + b := stringFromUnicode(rune(v.Uint())) + return Value{ + typecode: t, + value: unsafe.Pointer(&b), + flags: v.flags, + } } //go:linkname stringToRunes runtime.stringToRunes