mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
reflect: use int in StringHeader and SliceHeader on non-AVR platforms (#4156)
This commit is contained in:
+13
-3
@@ -1578,8 +1578,8 @@ type funcHeader struct {
|
||||
|
||||
type SliceHeader struct {
|
||||
Data uintptr
|
||||
Len uintptr
|
||||
Cap uintptr
|
||||
Len intw
|
||||
Cap intw
|
||||
}
|
||||
|
||||
// Slice header that matches the underlying structure. Used for when we switch
|
||||
@@ -1592,7 +1592,7 @@ type sliceHeader struct {
|
||||
|
||||
type StringHeader struct {
|
||||
Data uintptr
|
||||
Len uintptr
|
||||
Len intw
|
||||
}
|
||||
|
||||
// Like sliceHeader, this type is used internally to make sure pointer and
|
||||
@@ -1602,6 +1602,16 @@ type stringHeader struct {
|
||||
len uintptr
|
||||
}
|
||||
|
||||
// Verify SliceHeader and StringHeader sizes.
|
||||
// See https://github.com/tinygo-org/tinygo/pull/4156
|
||||
// and https://github.com/tinygo-org/tinygo/issues/1284.
|
||||
var (
|
||||
_ [unsafe.Sizeof([]byte{})]byte = [unsafe.Sizeof(SliceHeader{})]byte{}
|
||||
_ [unsafe.Sizeof([]byte{})]byte = [unsafe.Sizeof(sliceHeader{})]byte{}
|
||||
_ [unsafe.Sizeof("")]byte = [unsafe.Sizeof(StringHeader{})]byte{}
|
||||
_ [unsafe.Sizeof("")]byte = [unsafe.Sizeof(stringHeader{})]byte{}
|
||||
)
|
||||
|
||||
type ValueError struct {
|
||||
Method string
|
||||
Kind Kind
|
||||
|
||||
Reference in New Issue
Block a user