diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-12-30 02:36:26 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-30 02:36:26 +0000 |
commit | 8c26e4ad1a4d4669fcf4211bb4aa58d21ac1cb4a (patch) | |
tree | 4af5576e4e438d793a512140c5bfd8d20d1517d5 /pkg/marshal | |
parent | d4fe5f187efd73f6a92b2dc0682b01b87fa659e5 (diff) | |
parent | ffa9a715aaf4ebc4c8d8bef948649af358e4f4e4 (diff) |
Merge release-20201208.0-94-gffa9a715a (automated)
Diffstat (limited to 'pkg/marshal')
-rw-r--r-- | pkg/marshal/primitive/primitive_abi_autogen_unsafe.go | 400 |
1 files changed, 200 insertions, 200 deletions
diff --git a/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go b/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go index 9e49dbe6a..0ddb07673 100644 --- a/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go +++ b/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go @@ -25,40 +25,40 @@ var _ marshal.Marshallable = (*Uint8)(nil) // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (u *Uint16) SizeBytes() int { - return 2 +func (u *Uint32) SizeBytes() int { + return 4 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (u *Uint16) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint16(dst[:2], uint16(*u)) +func (u *Uint32) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint32(dst[:4], uint32(*u)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (u *Uint16) UnmarshalBytes(src []byte) { - *u = Uint16(uint16(usermem.ByteOrder.Uint16(src[:2]))) +func (u *Uint32) UnmarshalBytes(src []byte) { + *u = Uint32(uint32(usermem.ByteOrder.Uint32(src[:4]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (u *Uint16) Packed() bool { +func (u *Uint32) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (u *Uint16) MarshalUnsafe(dst []byte) { +func (u *Uint32) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(u)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (u *Uint16) UnmarshalUnsafe(src []byte) { +func (u *Uint32) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(u), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (u *Uint16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (u *Uint32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -75,13 +75,13 @@ func (u *Uint16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (u *Uint16) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint32) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return u.CopyOutN(cc, addr, u.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (u *Uint16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -97,7 +97,7 @@ func (u *Uint16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) } // WriteTo implements io.WriterTo.WriteTo. -func (u *Uint16) WriteTo(w io.Writer) (int64, error) { +func (u *Uint32) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -112,14 +112,14 @@ func (u *Uint16) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyUint16SliceIn copies in a slice of uint16 objects from the task's memory. +// CopyUint32SliceIn copies in a slice of uint32 objects from the task's memory. //go:nosplit -func CopyUint16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint16) (int, error) { +func CopyUint32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint32) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint16)(nil).SizeBytes() + size := (*Uint32)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -138,14 +138,14 @@ func CopyUint16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint16) return length, err } -// CopyUint16SliceOut copies a slice of uint16 objects to the task's memory. +// CopyUint32SliceOut copies a slice of uint32 objects to the task's memory. //go:nosplit -func CopyUint16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint16) (int, error) { +func CopyUint32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint32) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint16)(nil).SizeBytes() + size := (*Uint32)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -164,13 +164,13 @@ func CopyUint16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint16) return length, err } -// MarshalUnsafeUint16Slice is like Uint16.MarshalUnsafe, but for a []Uint16. -func MarshalUnsafeUint16Slice(src []Uint16, dst []byte) (int, error) { +// MarshalUnsafeUint32Slice is like Uint32.MarshalUnsafe, but for a []Uint32. +func MarshalUnsafeUint32Slice(src []Uint32, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint16)(nil).SizeBytes() + size := (*Uint32)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -182,13 +182,13 @@ func MarshalUnsafeUint16Slice(src []Uint16, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeUint16Slice is like Uint16.UnmarshalUnsafe, but for a []Uint16. -func UnmarshalUnsafeUint16Slice(dst []Uint16, src []byte) (int, error) { +// UnmarshalUnsafeUint32Slice is like Uint32.UnmarshalUnsafe, but for a []Uint32. +func UnmarshalUnsafeUint32Slice(dst []Uint32, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint16)(nil).SizeBytes() + size := (*Uint32)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -202,40 +202,40 @@ func UnmarshalUnsafeUint16Slice(dst []Uint16, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (i *Int32) SizeBytes() int { - return 4 +func (i *Int64) SizeBytes() int { + return 8 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (i *Int32) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint32(dst[:4], uint32(*i)) +func (i *Int64) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint64(dst[:8], uint64(*i)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (i *Int32) UnmarshalBytes(src []byte) { - *i = Int32(int32(usermem.ByteOrder.Uint32(src[:4]))) +func (i *Int64) UnmarshalBytes(src []byte) { + *i = Int64(int64(usermem.ByteOrder.Uint64(src[:8]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (i *Int32) Packed() bool { +func (i *Int64) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (i *Int32) MarshalUnsafe(dst []byte) { +func (i *Int64) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(i)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (i *Int32) UnmarshalUnsafe(src []byte) { +func (i *Int64) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(i), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (i *Int32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (i *Int64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -252,13 +252,13 @@ func (i *Int32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) ( // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (i *Int32) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return i.CopyOutN(cc, addr, i.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (i *Int32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -274,7 +274,7 @@ func (i *Int32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { } // WriteTo implements io.WriterTo.WriteTo. -func (i *Int32) WriteTo(w io.Writer) (int64, error) { +func (i *Int64) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -289,14 +289,14 @@ func (i *Int32) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyInt32SliceIn copies in a slice of int32 objects from the task's memory. +// CopyInt64SliceIn copies in a slice of int64 objects from the task's memory. //go:nosplit -func CopyInt32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int32) (int, error) { +func CopyInt64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int64) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int32)(nil).SizeBytes() + size := (*Int64)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -315,14 +315,14 @@ func CopyInt32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int32) (i return length, err } -// CopyInt32SliceOut copies a slice of int32 objects to the task's memory. +// CopyInt64SliceOut copies a slice of int64 objects to the task's memory. //go:nosplit -func CopyInt32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int32) (int, error) { +func CopyInt64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int64) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int32)(nil).SizeBytes() + size := (*Int64)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -341,13 +341,13 @@ func CopyInt32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int32) ( return length, err } -// MarshalUnsafeInt32Slice is like Int32.MarshalUnsafe, but for a []Int32. -func MarshalUnsafeInt32Slice(src []Int32, dst []byte) (int, error) { +// MarshalUnsafeInt64Slice is like Int64.MarshalUnsafe, but for a []Int64. +func MarshalUnsafeInt64Slice(src []Int64, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int32)(nil).SizeBytes() + size := (*Int64)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -359,13 +359,13 @@ func MarshalUnsafeInt32Slice(src []Int32, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeInt32Slice is like Int32.UnmarshalUnsafe, but for a []Int32. -func UnmarshalUnsafeInt32Slice(dst []Int32, src []byte) (int, error) { +// UnmarshalUnsafeInt64Slice is like Int64.UnmarshalUnsafe, but for a []Int64. +func UnmarshalUnsafeInt64Slice(dst []Int64, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int32)(nil).SizeBytes() + size := (*Int64)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -379,40 +379,40 @@ func UnmarshalUnsafeInt32Slice(dst []Int32, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (u *Uint32) SizeBytes() int { - return 4 +func (u *Uint64) SizeBytes() int { + return 8 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (u *Uint32) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint32(dst[:4], uint32(*u)) +func (u *Uint64) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint64(dst[:8], uint64(*u)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (u *Uint32) UnmarshalBytes(src []byte) { - *u = Uint32(uint32(usermem.ByteOrder.Uint32(src[:4]))) +func (u *Uint64) UnmarshalBytes(src []byte) { + *u = Uint64(uint64(usermem.ByteOrder.Uint64(src[:8]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (u *Uint32) Packed() bool { +func (u *Uint64) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (u *Uint32) MarshalUnsafe(dst []byte) { +func (u *Uint64) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(u)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (u *Uint32) UnmarshalUnsafe(src []byte) { +func (u *Uint64) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(u), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (u *Uint32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (u *Uint64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -429,13 +429,13 @@ func (u *Uint32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (u *Uint32) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return u.CopyOutN(cc, addr, u.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (u *Uint32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -451,7 +451,7 @@ func (u *Uint32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) } // WriteTo implements io.WriterTo.WriteTo. -func (u *Uint32) WriteTo(w io.Writer) (int64, error) { +func (u *Uint64) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -466,14 +466,14 @@ func (u *Uint32) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyUint32SliceIn copies in a slice of uint32 objects from the task's memory. +// CopyUint64SliceIn copies in a slice of uint64 objects from the task's memory. //go:nosplit -func CopyUint32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint32) (int, error) { +func CopyUint64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint64) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint32)(nil).SizeBytes() + size := (*Uint64)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -492,14 +492,14 @@ func CopyUint32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint32) return length, err } -// CopyUint32SliceOut copies a slice of uint32 objects to the task's memory. +// CopyUint64SliceOut copies a slice of uint64 objects to the task's memory. //go:nosplit -func CopyUint32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint32) (int, error) { +func CopyUint64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint64) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint32)(nil).SizeBytes() + size := (*Uint64)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -518,13 +518,13 @@ func CopyUint32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint32) return length, err } -// MarshalUnsafeUint32Slice is like Uint32.MarshalUnsafe, but for a []Uint32. -func MarshalUnsafeUint32Slice(src []Uint32, dst []byte) (int, error) { +// MarshalUnsafeUint64Slice is like Uint64.MarshalUnsafe, but for a []Uint64. +func MarshalUnsafeUint64Slice(src []Uint64, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint32)(nil).SizeBytes() + size := (*Uint64)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -536,13 +536,13 @@ func MarshalUnsafeUint32Slice(src []Uint32, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeUint32Slice is like Uint32.UnmarshalUnsafe, but for a []Uint32. -func UnmarshalUnsafeUint32Slice(dst []Uint32, src []byte) (int, error) { +// UnmarshalUnsafeUint64Slice is like Uint64.UnmarshalUnsafe, but for a []Uint64. +func UnmarshalUnsafeUint64Slice(dst []Uint64, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint32)(nil).SizeBytes() + size := (*Uint64)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -556,40 +556,40 @@ func UnmarshalUnsafeUint32Slice(dst []Uint32, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (i *Int64) SizeBytes() int { - return 8 +func (i *Int8) SizeBytes() int { + return 1 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (i *Int64) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint64(dst[:8], uint64(*i)) +func (i *Int8) MarshalBytes(dst []byte) { + dst[0] = byte(*i) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (i *Int64) UnmarshalBytes(src []byte) { - *i = Int64(int64(usermem.ByteOrder.Uint64(src[:8]))) +func (i *Int8) UnmarshalBytes(src []byte) { + *i = Int8(int8(src[0])) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (i *Int64) Packed() bool { +func (i *Int8) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (i *Int64) MarshalUnsafe(dst []byte) { +func (i *Int8) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(i)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (i *Int64) UnmarshalUnsafe(src []byte) { +func (i *Int8) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(i), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (i *Int64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (i *Int8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -606,13 +606,13 @@ func (i *Int64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) ( // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (i *Int64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int8) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return i.CopyOutN(cc, addr, i.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (i *Int64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -628,7 +628,7 @@ func (i *Int64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { } // WriteTo implements io.WriterTo.WriteTo. -func (i *Int64) WriteTo(w io.Writer) (int64, error) { +func (i *Int8) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -643,14 +643,14 @@ func (i *Int64) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyInt64SliceIn copies in a slice of int64 objects from the task's memory. +// CopyInt8SliceIn copies in a slice of int8 objects from the task's memory. //go:nosplit -func CopyInt64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int64) (int, error) { +func CopyInt8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int8) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int64)(nil).SizeBytes() + size := (*Int8)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -669,14 +669,14 @@ func CopyInt64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int64) (i return length, err } -// CopyInt64SliceOut copies a slice of int64 objects to the task's memory. +// CopyInt8SliceOut copies a slice of int8 objects to the task's memory. //go:nosplit -func CopyInt64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int64) (int, error) { +func CopyInt8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int8) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int64)(nil).SizeBytes() + size := (*Int8)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -695,13 +695,13 @@ func CopyInt64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int64) ( return length, err } -// MarshalUnsafeInt64Slice is like Int64.MarshalUnsafe, but for a []Int64. -func MarshalUnsafeInt64Slice(src []Int64, dst []byte) (int, error) { +// MarshalUnsafeInt8Slice is like Int8.MarshalUnsafe, but for a []Int8. +func MarshalUnsafeInt8Slice(src []Int8, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int64)(nil).SizeBytes() + size := (*Int8)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -713,13 +713,13 @@ func MarshalUnsafeInt64Slice(src []Int64, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeInt64Slice is like Int64.UnmarshalUnsafe, but for a []Int64. -func UnmarshalUnsafeInt64Slice(dst []Int64, src []byte) (int, error) { +// UnmarshalUnsafeInt8Slice is like Int8.UnmarshalUnsafe, but for a []Int8. +func UnmarshalUnsafeInt8Slice(dst []Int8, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int64)(nil).SizeBytes() + size := (*Int8)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -733,40 +733,40 @@ func UnmarshalUnsafeInt64Slice(dst []Int64, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (u *Uint64) SizeBytes() int { - return 8 +func (u *Uint8) SizeBytes() int { + return 1 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (u *Uint64) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint64(dst[:8], uint64(*u)) +func (u *Uint8) MarshalBytes(dst []byte) { + dst[0] = byte(*u) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (u *Uint64) UnmarshalBytes(src []byte) { - *u = Uint64(uint64(usermem.ByteOrder.Uint64(src[:8]))) +func (u *Uint8) UnmarshalBytes(src []byte) { + *u = Uint8(uint8(src[0])) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (u *Uint64) Packed() bool { +func (u *Uint8) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (u *Uint64) MarshalUnsafe(dst []byte) { +func (u *Uint8) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(u)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (u *Uint64) UnmarshalUnsafe(src []byte) { +func (u *Uint8) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(u), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (u *Uint64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (u *Uint8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -783,13 +783,13 @@ func (u *Uint64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (u *Uint64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint8) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return u.CopyOutN(cc, addr, u.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (u *Uint64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -805,7 +805,7 @@ func (u *Uint64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) } // WriteTo implements io.WriterTo.WriteTo. -func (u *Uint64) WriteTo(w io.Writer) (int64, error) { +func (u *Uint8) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -820,14 +820,14 @@ func (u *Uint64) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyUint64SliceIn copies in a slice of uint64 objects from the task's memory. +// CopyUint8SliceIn copies in a slice of uint8 objects from the task's memory. //go:nosplit -func CopyUint64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint64) (int, error) { +func CopyUint8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint8) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint64)(nil).SizeBytes() + size := (*Uint8)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -846,14 +846,14 @@ func CopyUint64SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint64) return length, err } -// CopyUint64SliceOut copies a slice of uint64 objects to the task's memory. +// CopyUint8SliceOut copies a slice of uint8 objects to the task's memory. //go:nosplit -func CopyUint64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint64) (int, error) { +func CopyUint8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint8) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint64)(nil).SizeBytes() + size := (*Uint8)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -872,13 +872,13 @@ func CopyUint64SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint64) return length, err } -// MarshalUnsafeUint64Slice is like Uint64.MarshalUnsafe, but for a []Uint64. -func MarshalUnsafeUint64Slice(src []Uint64, dst []byte) (int, error) { +// MarshalUnsafeUint8Slice is like Uint8.MarshalUnsafe, but for a []Uint8. +func MarshalUnsafeUint8Slice(src []Uint8, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint64)(nil).SizeBytes() + size := (*Uint8)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -890,13 +890,13 @@ func MarshalUnsafeUint64Slice(src []Uint64, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeUint64Slice is like Uint64.UnmarshalUnsafe, but for a []Uint64. -func UnmarshalUnsafeUint64Slice(dst []Uint64, src []byte) (int, error) { +// UnmarshalUnsafeUint8Slice is like Uint8.UnmarshalUnsafe, but for a []Uint8. +func UnmarshalUnsafeUint8Slice(dst []Uint8, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint64)(nil).SizeBytes() + size := (*Uint8)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -910,40 +910,40 @@ func UnmarshalUnsafeUint64Slice(dst []Uint64, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (i *Int8) SizeBytes() int { - return 1 +func (i *Int16) SizeBytes() int { + return 2 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (i *Int8) MarshalBytes(dst []byte) { - dst[0] = byte(*i) +func (i *Int16) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint16(dst[:2], uint16(*i)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (i *Int8) UnmarshalBytes(src []byte) { - *i = Int8(int8(src[0])) +func (i *Int16) UnmarshalBytes(src []byte) { + *i = Int16(int16(usermem.ByteOrder.Uint16(src[:2]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (i *Int8) Packed() bool { +func (i *Int16) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (i *Int8) MarshalUnsafe(dst []byte) { +func (i *Int16) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(i)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (i *Int8) UnmarshalUnsafe(src []byte) { +func (i *Int16) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(i), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (i *Int8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (i *Int16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -960,13 +960,13 @@ func (i *Int8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (i // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (i *Int8) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int16) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return i.CopyOutN(cc, addr, i.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (i *Int8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -982,7 +982,7 @@ func (i *Int8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { } // WriteTo implements io.WriterTo.WriteTo. -func (i *Int8) WriteTo(w io.Writer) (int64, error) { +func (i *Int16) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -997,14 +997,14 @@ func (i *Int8) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyInt8SliceIn copies in a slice of int8 objects from the task's memory. +// CopyInt16SliceIn copies in a slice of int16 objects from the task's memory. //go:nosplit -func CopyInt8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int8) (int, error) { +func CopyInt16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int16) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int8)(nil).SizeBytes() + size := (*Int16)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1023,14 +1023,14 @@ func CopyInt8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int8) (int return length, err } -// CopyInt8SliceOut copies a slice of int8 objects to the task's memory. +// CopyInt16SliceOut copies a slice of int16 objects to the task's memory. //go:nosplit -func CopyInt8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int8) (int, error) { +func CopyInt16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int16) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int8)(nil).SizeBytes() + size := (*Int16)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1049,13 +1049,13 @@ func CopyInt8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int8) (in return length, err } -// MarshalUnsafeInt8Slice is like Int8.MarshalUnsafe, but for a []Int8. -func MarshalUnsafeInt8Slice(src []Int8, dst []byte) (int, error) { +// MarshalUnsafeInt16Slice is like Int16.MarshalUnsafe, but for a []Int16. +func MarshalUnsafeInt16Slice(src []Int16, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int8)(nil).SizeBytes() + size := (*Int16)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1067,13 +1067,13 @@ func MarshalUnsafeInt8Slice(src []Int8, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeInt8Slice is like Int8.UnmarshalUnsafe, but for a []Int8. -func UnmarshalUnsafeInt8Slice(dst []Int8, src []byte) (int, error) { +// UnmarshalUnsafeInt16Slice is like Int16.UnmarshalUnsafe, but for a []Int16. +func UnmarshalUnsafeInt16Slice(dst []Int16, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int8)(nil).SizeBytes() + size := (*Int16)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1087,40 +1087,40 @@ func UnmarshalUnsafeInt8Slice(dst []Int8, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (u *Uint8) SizeBytes() int { - return 1 +func (u *Uint16) SizeBytes() int { + return 2 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (u *Uint8) MarshalBytes(dst []byte) { - dst[0] = byte(*u) +func (u *Uint16) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint16(dst[:2], uint16(*u)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (u *Uint8) UnmarshalBytes(src []byte) { - *u = Uint8(uint8(src[0])) +func (u *Uint16) UnmarshalBytes(src []byte) { + *u = Uint16(uint16(usermem.ByteOrder.Uint16(src[:2]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (u *Uint8) Packed() bool { +func (u *Uint16) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (u *Uint8) MarshalUnsafe(dst []byte) { +func (u *Uint16) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(u)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (u *Uint8) UnmarshalUnsafe(src []byte) { +func (u *Uint16) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(u), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (u *Uint8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (u *Uint16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1137,13 +1137,13 @@ func (u *Uint8) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) ( // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (u *Uint8) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint16) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return u.CopyOutN(cc, addr, u.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (u *Uint8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (u *Uint16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1159,7 +1159,7 @@ func (u *Uint8) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { } // WriteTo implements io.WriterTo.WriteTo. -func (u *Uint8) WriteTo(w io.Writer) (int64, error) { +func (u *Uint16) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1174,14 +1174,14 @@ func (u *Uint8) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyUint8SliceIn copies in a slice of uint8 objects from the task's memory. +// CopyUint16SliceIn copies in a slice of uint16 objects from the task's memory. //go:nosplit -func CopyUint8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint8) (int, error) { +func CopyUint16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint16) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint8)(nil).SizeBytes() + size := (*Uint16)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1200,14 +1200,14 @@ func CopyUint8SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []uint8) (i return length, err } -// CopyUint8SliceOut copies a slice of uint8 objects to the task's memory. +// CopyUint16SliceOut copies a slice of uint16 objects to the task's memory. //go:nosplit -func CopyUint8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint8) (int, error) { +func CopyUint16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint16) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint8)(nil).SizeBytes() + size := (*Uint16)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1226,13 +1226,13 @@ func CopyUint8SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []uint8) ( return length, err } -// MarshalUnsafeUint8Slice is like Uint8.MarshalUnsafe, but for a []Uint8. -func MarshalUnsafeUint8Slice(src []Uint8, dst []byte) (int, error) { +// MarshalUnsafeUint16Slice is like Uint16.MarshalUnsafe, but for a []Uint16. +func MarshalUnsafeUint16Slice(src []Uint16, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Uint8)(nil).SizeBytes() + size := (*Uint16)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1244,13 +1244,13 @@ func MarshalUnsafeUint8Slice(src []Uint8, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeUint8Slice is like Uint8.UnmarshalUnsafe, but for a []Uint8. -func UnmarshalUnsafeUint8Slice(dst []Uint8, src []byte) (int, error) { +// UnmarshalUnsafeUint16Slice is like Uint16.UnmarshalUnsafe, but for a []Uint16. +func UnmarshalUnsafeUint16Slice(dst []Uint16, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Uint8)(nil).SizeBytes() + size := (*Uint16)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1264,40 +1264,40 @@ func UnmarshalUnsafeUint8Slice(dst []Uint8, src []byte) (int, error) { // SizeBytes implements marshal.Marshallable.SizeBytes. //go:nosplit -func (i *Int16) SizeBytes() int { - return 2 +func (i *Int32) SizeBytes() int { + return 4 } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (i *Int16) MarshalBytes(dst []byte) { - usermem.ByteOrder.PutUint16(dst[:2], uint16(*i)) +func (i *Int32) MarshalBytes(dst []byte) { + usermem.ByteOrder.PutUint32(dst[:4], uint32(*i)) } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (i *Int16) UnmarshalBytes(src []byte) { - *i = Int16(int16(usermem.ByteOrder.Uint16(src[:2]))) +func (i *Int32) UnmarshalBytes(src []byte) { + *i = Int32(int32(usermem.ByteOrder.Uint32(src[:4]))) } // Packed implements marshal.Marshallable.Packed. //go:nosplit -func (i *Int16) Packed() bool { +func (i *Int32) Packed() bool { // Scalar newtypes are always packed. return true } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (i *Int16) MarshalUnsafe(dst []byte) { +func (i *Int32) MarshalUnsafe(dst []byte) { safecopy.CopyIn(dst, unsafe.Pointer(i)) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (i *Int16) UnmarshalUnsafe(src []byte) { +func (i *Int32) UnmarshalUnsafe(src []byte) { safecopy.CopyOut(unsafe.Pointer(i), src) } // CopyOutN implements marshal.Marshallable.CopyOutN. //go:nosplit -func (i *Int16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { +func (i *Int32) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1314,13 +1314,13 @@ func (i *Int16) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) ( // CopyOut implements marshal.Marshallable.CopyOut. //go:nosplit -func (i *Int16) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int32) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) { return i.CopyOutN(cc, addr, i.SizeBytes()) } // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit -func (i *Int16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { +func (i *Int32) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1336,7 +1336,7 @@ func (i *Int16) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) { } // WriteTo implements io.WriterTo.WriteTo. -func (i *Int16) WriteTo(w io.Writer) (int64, error) { +func (i *Int32) WriteTo(w io.Writer) (int64, error) { // Construct a slice backed by dst's underlying memory. var buf []byte hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) @@ -1351,14 +1351,14 @@ func (i *Int16) WriteTo(w io.Writer) (int64, error) { return int64(length), err } -// CopyInt16SliceIn copies in a slice of int16 objects from the task's memory. +// CopyInt32SliceIn copies in a slice of int32 objects from the task's memory. //go:nosplit -func CopyInt16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int16) (int, error) { +func CopyInt32SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int32) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int16)(nil).SizeBytes() + size := (*Int32)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1377,14 +1377,14 @@ func CopyInt16SliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []int16) (i return length, err } -// CopyInt16SliceOut copies a slice of int16 objects to the task's memory. +// CopyInt32SliceOut copies a slice of int32 objects to the task's memory. //go:nosplit -func CopyInt16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int16) (int, error) { +func CopyInt32SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int32) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int16)(nil).SizeBytes() + size := (*Int32)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1403,13 +1403,13 @@ func CopyInt16SliceOut(cc marshal.CopyContext, addr usermem.Addr, src []int16) ( return length, err } -// MarshalUnsafeInt16Slice is like Int16.MarshalUnsafe, but for a []Int16. -func MarshalUnsafeInt16Slice(src []Int16, dst []byte) (int, error) { +// MarshalUnsafeInt32Slice is like Int32.MarshalUnsafe, but for a []Int32. +func MarshalUnsafeInt32Slice(src []Int32, dst []byte) (int, error) { count := len(src) if count == 0 { return 0, nil } - size := (*Int16)(nil).SizeBytes() + size := (*Int32)(nil).SizeBytes() ptr := unsafe.Pointer(&src) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) @@ -1421,13 +1421,13 @@ func MarshalUnsafeInt16Slice(src []Int16, dst []byte) (int, error) { return length, err } -// UnmarshalUnsafeInt16Slice is like Int16.UnmarshalUnsafe, but for a []Int16. -func UnmarshalUnsafeInt16Slice(dst []Int16, src []byte) (int, error) { +// UnmarshalUnsafeInt32Slice is like Int32.UnmarshalUnsafe, but for a []Int32. +func UnmarshalUnsafeInt32Slice(dst []Int32, src []byte) (int, error) { count := len(dst) if count == 0 { return 0, nil } - size := (*Int16)(nil).SizeBytes() + size := (*Int32)(nil).SizeBytes() ptr := unsafe.Pointer(&dst) val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) |