internal/runtime: fix abi.UnsafePointer PtrBytes

This commit is contained in:
visualfc
2025-05-16 11:57:14 +08:00
parent 9a16fff27e
commit 953699b2fd

View File

@@ -72,13 +72,13 @@ func Basic(_kind Kind) *Type {
kind := _kind & abi.KindMask
if tyBasic[kind] == nil {
name, size, align := basicTypeInfo(kind)
var bytes uintptr
if kind == abi.String {
bytes = pointerSize
var ptrBytes uintptr
if kind == abi.String || kind == abi.UnsafePointer {
ptrBytes = pointerSize
}
tyBasic[kind] = &Type{
Size_: size,
PtrBytes: bytes,
PtrBytes: ptrBytes,
Hash: uint32(kind),
Align_: uint8(align),
FieldAlign_: uint8(align),