github.com/ttpreport/gvisor-ligolo@v0.0.0-20240123134145-a858404967ba/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go (about)

     1  // Automatically generated marshal implementation. See tools/go_marshal.
     2  
     3  package primitive
     4  
     5  import (
     6  	"github.com/ttpreport/gvisor-ligolo/pkg/gohacks"
     7  	"github.com/ttpreport/gvisor-ligolo/pkg/hostarch"
     8  	"github.com/ttpreport/gvisor-ligolo/pkg/marshal"
     9  	"io"
    10  	"reflect"
    11  	"runtime"
    12  	"unsafe"
    13  )
    14  
    15  // Marshallable types used by this file.
    16  var _ marshal.Marshallable = (*Int16)(nil)
    17  var _ marshal.Marshallable = (*Int32)(nil)
    18  var _ marshal.Marshallable = (*Int64)(nil)
    19  var _ marshal.Marshallable = (*Int8)(nil)
    20  var _ marshal.Marshallable = (*Uint16)(nil)
    21  var _ marshal.Marshallable = (*Uint32)(nil)
    22  var _ marshal.Marshallable = (*Uint64)(nil)
    23  var _ marshal.Marshallable = (*Uint8)(nil)
    24  
    25  // SizeBytes implements marshal.Marshallable.SizeBytes.
    26  //
    27  //go:nosplit
    28  func (i *Int16) SizeBytes() int {
    29  	return 2
    30  }
    31  
    32  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
    33  func (i *Int16) MarshalBytes(dst []byte) []byte {
    34  	hostarch.ByteOrder.PutUint16(dst[:2], uint16(*i))
    35  	return dst[2:]
    36  }
    37  
    38  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
    39  func (i *Int16) UnmarshalBytes(src []byte) []byte {
    40  	*i = Int16(int16(hostarch.ByteOrder.Uint16(src[:2])))
    41  	return src[2:]
    42  }
    43  
    44  // Packed implements marshal.Marshallable.Packed.
    45  //
    46  //go:nosplit
    47  func (i *Int16) Packed() bool {
    48  	// Scalar newtypes are always packed.
    49  	return true
    50  }
    51  
    52  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
    53  func (i *Int16) MarshalUnsafe(dst []byte) []byte {
    54  	size := i.SizeBytes()
    55  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
    56  	return dst[size:]
    57  }
    58  
    59  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
    60  func (i *Int16) UnmarshalUnsafe(src []byte) []byte {
    61  	size := i.SizeBytes()
    62  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
    63  	return src[size:]
    64  }
    65  
    66  // CopyOutN implements marshal.Marshallable.CopyOutN.
    67  func (i *Int16) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
    68  	// Construct a slice backed by dst's underlying memory.
    69  	var buf []byte
    70  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    71  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
    72  	hdr.Len = i.SizeBytes()
    73  	hdr.Cap = i.SizeBytes()
    74  
    75  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
    76  	// Since we bypassed the compiler's escape analysis, indicate that i
    77  	// must live until the use above.
    78  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
    79  	return length, err
    80  }
    81  
    82  // CopyOut implements marshal.Marshallable.CopyOut.
    83  func (i *Int16) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
    84  	return i.CopyOutN(cc, addr, i.SizeBytes())
    85  }
    86  
    87  // CopyIn implements marshal.Marshallable.CopyIn.
    88  func (i *Int16) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
    89  	// Construct a slice backed by dst's underlying memory.
    90  	var buf []byte
    91  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    92  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
    93  	hdr.Len = i.SizeBytes()
    94  	hdr.Cap = i.SizeBytes()
    95  
    96  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
    97  	// Since we bypassed the compiler's escape analysis, indicate that i
    98  	// must live until the use above.
    99  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   100  	return length, err
   101  }
   102  
   103  // WriteTo implements io.WriterTo.WriteTo.
   104  func (i *Int16) WriteTo(writer io.Writer) (int64, error) {
   105  	// Construct a slice backed by dst's underlying memory.
   106  	var buf []byte
   107  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   108  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   109  	hdr.Len = i.SizeBytes()
   110  	hdr.Cap = i.SizeBytes()
   111  
   112  	length, err := writer.Write(buf)
   113  	// Since we bypassed the compiler's escape analysis, indicate that i
   114  	// must live until the use above.
   115  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   116  	return int64(length), err
   117  }
   118  
   119  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   120  func (i *Int16) CheckedMarshal(dst []byte) ([]byte, bool) {
   121  	size := i.SizeBytes()
   122  	if size > len(dst) {
   123  		return dst, false
   124  	}
   125  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   126  	return dst[size:], true
   127  }
   128  
   129  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   130  func (i *Int16) CheckedUnmarshal(src []byte) ([]byte, bool) {
   131  	size := i.SizeBytes()
   132  	if size > len(src) {
   133  		return src, false
   134  	}
   135  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   136  	return src[size:], true
   137  }
   138  
   139  // CopyInt16SliceIn copies in a slice of int16 objects from the task's memory.
   140  func CopyInt16SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int16) (int, error) {
   141  	count := len(dst)
   142  	if count == 0 {
   143  		return 0, nil
   144  	}
   145  	size := (*Int16)(nil).SizeBytes()
   146  
   147  	ptr := unsafe.Pointer(&dst)
   148  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   149  
   150  	// Construct a slice backed by dst's underlying memory.
   151  	var buf []byte
   152  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   153  	hdr.Data = uintptr(val)
   154  	hdr.Len = size * count
   155  	hdr.Cap = size * count
   156  
   157  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   158  	// Since we bypassed the compiler's escape analysis, indicate that dst
   159  	// must live until the use above.
   160  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   161  	return length, err
   162  }
   163  
   164  // CopyInt16SliceOut copies a slice of int16 objects to the task's memory.
   165  func CopyInt16SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int16) (int, error) {
   166  	count := len(src)
   167  	if count == 0 {
   168  		return 0, nil
   169  	}
   170  	size := (*Int16)(nil).SizeBytes()
   171  
   172  	ptr := unsafe.Pointer(&src)
   173  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   174  
   175  	// Construct a slice backed by dst's underlying memory.
   176  	var buf []byte
   177  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   178  	hdr.Data = uintptr(val)
   179  	hdr.Len = size * count
   180  	hdr.Cap = size * count
   181  
   182  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   183  	// Since we bypassed the compiler's escape analysis, indicate that src
   184  	// must live until the use above.
   185  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   186  	return length, err
   187  }
   188  
   189  // MarshalUnsafeInt16Slice is like Int16.MarshalUnsafe, but for a []Int16.
   190  func MarshalUnsafeInt16Slice(src []Int16, dst []byte) []byte {
   191  	count := len(src)
   192  	if count == 0 {
   193  		return dst
   194  	}
   195  	size := (*Int16)(nil).SizeBytes()
   196  
   197  	buf := dst[:size*count]
   198  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   199  	return dst[size*count:]
   200  }
   201  
   202  // UnmarshalUnsafeInt16Slice is like Int16.UnmarshalUnsafe, but for a []Int16.
   203  func UnmarshalUnsafeInt16Slice(dst []Int16, src []byte) []byte {
   204  	count := len(dst)
   205  	if count == 0 {
   206  		return src
   207  	}
   208  	size := (*Int16)(nil).SizeBytes()
   209  
   210  	buf := src[:size*count]
   211  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   212  	return src[size*count:]
   213  }
   214  
   215  // SizeBytes implements marshal.Marshallable.SizeBytes.
   216  //
   217  //go:nosplit
   218  func (i *Int32) SizeBytes() int {
   219  	return 4
   220  }
   221  
   222  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   223  func (i *Int32) MarshalBytes(dst []byte) []byte {
   224  	hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i))
   225  	return dst[4:]
   226  }
   227  
   228  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   229  func (i *Int32) UnmarshalBytes(src []byte) []byte {
   230  	*i = Int32(int32(hostarch.ByteOrder.Uint32(src[:4])))
   231  	return src[4:]
   232  }
   233  
   234  // Packed implements marshal.Marshallable.Packed.
   235  //
   236  //go:nosplit
   237  func (i *Int32) Packed() bool {
   238  	// Scalar newtypes are always packed.
   239  	return true
   240  }
   241  
   242  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   243  func (i *Int32) MarshalUnsafe(dst []byte) []byte {
   244  	size := i.SizeBytes()
   245  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   246  	return dst[size:]
   247  }
   248  
   249  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   250  func (i *Int32) UnmarshalUnsafe(src []byte) []byte {
   251  	size := i.SizeBytes()
   252  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   253  	return src[size:]
   254  }
   255  
   256  // CopyOutN implements marshal.Marshallable.CopyOutN.
   257  func (i *Int32) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   258  	// Construct a slice backed by dst's underlying memory.
   259  	var buf []byte
   260  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   261  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   262  	hdr.Len = i.SizeBytes()
   263  	hdr.Cap = i.SizeBytes()
   264  
   265  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   266  	// Since we bypassed the compiler's escape analysis, indicate that i
   267  	// must live until the use above.
   268  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   269  	return length, err
   270  }
   271  
   272  // CopyOut implements marshal.Marshallable.CopyOut.
   273  func (i *Int32) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   274  	return i.CopyOutN(cc, addr, i.SizeBytes())
   275  }
   276  
   277  // CopyIn implements marshal.Marshallable.CopyIn.
   278  func (i *Int32) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   279  	// Construct a slice backed by dst's underlying memory.
   280  	var buf []byte
   281  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   282  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   283  	hdr.Len = i.SizeBytes()
   284  	hdr.Cap = i.SizeBytes()
   285  
   286  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   287  	// Since we bypassed the compiler's escape analysis, indicate that i
   288  	// must live until the use above.
   289  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   290  	return length, err
   291  }
   292  
   293  // WriteTo implements io.WriterTo.WriteTo.
   294  func (i *Int32) WriteTo(writer io.Writer) (int64, error) {
   295  	// Construct a slice backed by dst's underlying memory.
   296  	var buf []byte
   297  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   298  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   299  	hdr.Len = i.SizeBytes()
   300  	hdr.Cap = i.SizeBytes()
   301  
   302  	length, err := writer.Write(buf)
   303  	// Since we bypassed the compiler's escape analysis, indicate that i
   304  	// must live until the use above.
   305  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   306  	return int64(length), err
   307  }
   308  
   309  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   310  func (i *Int32) CheckedMarshal(dst []byte) ([]byte, bool) {
   311  	size := i.SizeBytes()
   312  	if size > len(dst) {
   313  		return dst, false
   314  	}
   315  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   316  	return dst[size:], true
   317  }
   318  
   319  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   320  func (i *Int32) CheckedUnmarshal(src []byte) ([]byte, bool) {
   321  	size := i.SizeBytes()
   322  	if size > len(src) {
   323  		return src, false
   324  	}
   325  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   326  	return src[size:], true
   327  }
   328  
   329  // CopyInt32SliceIn copies in a slice of int32 objects from the task's memory.
   330  func CopyInt32SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int32) (int, error) {
   331  	count := len(dst)
   332  	if count == 0 {
   333  		return 0, nil
   334  	}
   335  	size := (*Int32)(nil).SizeBytes()
   336  
   337  	ptr := unsafe.Pointer(&dst)
   338  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   339  
   340  	// Construct a slice backed by dst's underlying memory.
   341  	var buf []byte
   342  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   343  	hdr.Data = uintptr(val)
   344  	hdr.Len = size * count
   345  	hdr.Cap = size * count
   346  
   347  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   348  	// Since we bypassed the compiler's escape analysis, indicate that dst
   349  	// must live until the use above.
   350  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   351  	return length, err
   352  }
   353  
   354  // CopyInt32SliceOut copies a slice of int32 objects to the task's memory.
   355  func CopyInt32SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int32) (int, error) {
   356  	count := len(src)
   357  	if count == 0 {
   358  		return 0, nil
   359  	}
   360  	size := (*Int32)(nil).SizeBytes()
   361  
   362  	ptr := unsafe.Pointer(&src)
   363  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   364  
   365  	// Construct a slice backed by dst's underlying memory.
   366  	var buf []byte
   367  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   368  	hdr.Data = uintptr(val)
   369  	hdr.Len = size * count
   370  	hdr.Cap = size * count
   371  
   372  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   373  	// Since we bypassed the compiler's escape analysis, indicate that src
   374  	// must live until the use above.
   375  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   376  	return length, err
   377  }
   378  
   379  // MarshalUnsafeInt32Slice is like Int32.MarshalUnsafe, but for a []Int32.
   380  func MarshalUnsafeInt32Slice(src []Int32, dst []byte) []byte {
   381  	count := len(src)
   382  	if count == 0 {
   383  		return dst
   384  	}
   385  	size := (*Int32)(nil).SizeBytes()
   386  
   387  	buf := dst[:size*count]
   388  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   389  	return dst[size*count:]
   390  }
   391  
   392  // UnmarshalUnsafeInt32Slice is like Int32.UnmarshalUnsafe, but for a []Int32.
   393  func UnmarshalUnsafeInt32Slice(dst []Int32, src []byte) []byte {
   394  	count := len(dst)
   395  	if count == 0 {
   396  		return src
   397  	}
   398  	size := (*Int32)(nil).SizeBytes()
   399  
   400  	buf := src[:size*count]
   401  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   402  	return src[size*count:]
   403  }
   404  
   405  // SizeBytes implements marshal.Marshallable.SizeBytes.
   406  //
   407  //go:nosplit
   408  func (i *Int64) SizeBytes() int {
   409  	return 8
   410  }
   411  
   412  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   413  func (i *Int64) MarshalBytes(dst []byte) []byte {
   414  	hostarch.ByteOrder.PutUint64(dst[:8], uint64(*i))
   415  	return dst[8:]
   416  }
   417  
   418  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   419  func (i *Int64) UnmarshalBytes(src []byte) []byte {
   420  	*i = Int64(int64(hostarch.ByteOrder.Uint64(src[:8])))
   421  	return src[8:]
   422  }
   423  
   424  // Packed implements marshal.Marshallable.Packed.
   425  //
   426  //go:nosplit
   427  func (i *Int64) Packed() bool {
   428  	// Scalar newtypes are always packed.
   429  	return true
   430  }
   431  
   432  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   433  func (i *Int64) MarshalUnsafe(dst []byte) []byte {
   434  	size := i.SizeBytes()
   435  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   436  	return dst[size:]
   437  }
   438  
   439  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   440  func (i *Int64) UnmarshalUnsafe(src []byte) []byte {
   441  	size := i.SizeBytes()
   442  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   443  	return src[size:]
   444  }
   445  
   446  // CopyOutN implements marshal.Marshallable.CopyOutN.
   447  func (i *Int64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   448  	// Construct a slice backed by dst's underlying memory.
   449  	var buf []byte
   450  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   451  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   452  	hdr.Len = i.SizeBytes()
   453  	hdr.Cap = i.SizeBytes()
   454  
   455  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   456  	// Since we bypassed the compiler's escape analysis, indicate that i
   457  	// must live until the use above.
   458  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   459  	return length, err
   460  }
   461  
   462  // CopyOut implements marshal.Marshallable.CopyOut.
   463  func (i *Int64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   464  	return i.CopyOutN(cc, addr, i.SizeBytes())
   465  }
   466  
   467  // CopyIn implements marshal.Marshallable.CopyIn.
   468  func (i *Int64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   469  	// Construct a slice backed by dst's underlying memory.
   470  	var buf []byte
   471  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   472  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   473  	hdr.Len = i.SizeBytes()
   474  	hdr.Cap = i.SizeBytes()
   475  
   476  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   477  	// Since we bypassed the compiler's escape analysis, indicate that i
   478  	// must live until the use above.
   479  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   480  	return length, err
   481  }
   482  
   483  // WriteTo implements io.WriterTo.WriteTo.
   484  func (i *Int64) WriteTo(writer io.Writer) (int64, error) {
   485  	// Construct a slice backed by dst's underlying memory.
   486  	var buf []byte
   487  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   488  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   489  	hdr.Len = i.SizeBytes()
   490  	hdr.Cap = i.SizeBytes()
   491  
   492  	length, err := writer.Write(buf)
   493  	// Since we bypassed the compiler's escape analysis, indicate that i
   494  	// must live until the use above.
   495  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   496  	return int64(length), err
   497  }
   498  
   499  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   500  func (i *Int64) CheckedMarshal(dst []byte) ([]byte, bool) {
   501  	size := i.SizeBytes()
   502  	if size > len(dst) {
   503  		return dst, false
   504  	}
   505  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   506  	return dst[size:], true
   507  }
   508  
   509  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   510  func (i *Int64) CheckedUnmarshal(src []byte) ([]byte, bool) {
   511  	size := i.SizeBytes()
   512  	if size > len(src) {
   513  		return src, false
   514  	}
   515  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   516  	return src[size:], true
   517  }
   518  
   519  // CopyInt64SliceIn copies in a slice of int64 objects from the task's memory.
   520  func CopyInt64SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int64) (int, error) {
   521  	count := len(dst)
   522  	if count == 0 {
   523  		return 0, nil
   524  	}
   525  	size := (*Int64)(nil).SizeBytes()
   526  
   527  	ptr := unsafe.Pointer(&dst)
   528  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   529  
   530  	// Construct a slice backed by dst's underlying memory.
   531  	var buf []byte
   532  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   533  	hdr.Data = uintptr(val)
   534  	hdr.Len = size * count
   535  	hdr.Cap = size * count
   536  
   537  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   538  	// Since we bypassed the compiler's escape analysis, indicate that dst
   539  	// must live until the use above.
   540  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   541  	return length, err
   542  }
   543  
   544  // CopyInt64SliceOut copies a slice of int64 objects to the task's memory.
   545  func CopyInt64SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int64) (int, error) {
   546  	count := len(src)
   547  	if count == 0 {
   548  		return 0, nil
   549  	}
   550  	size := (*Int64)(nil).SizeBytes()
   551  
   552  	ptr := unsafe.Pointer(&src)
   553  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   554  
   555  	// Construct a slice backed by dst's underlying memory.
   556  	var buf []byte
   557  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   558  	hdr.Data = uintptr(val)
   559  	hdr.Len = size * count
   560  	hdr.Cap = size * count
   561  
   562  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   563  	// Since we bypassed the compiler's escape analysis, indicate that src
   564  	// must live until the use above.
   565  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   566  	return length, err
   567  }
   568  
   569  // MarshalUnsafeInt64Slice is like Int64.MarshalUnsafe, but for a []Int64.
   570  func MarshalUnsafeInt64Slice(src []Int64, dst []byte) []byte {
   571  	count := len(src)
   572  	if count == 0 {
   573  		return dst
   574  	}
   575  	size := (*Int64)(nil).SizeBytes()
   576  
   577  	buf := dst[:size*count]
   578  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   579  	return dst[size*count:]
   580  }
   581  
   582  // UnmarshalUnsafeInt64Slice is like Int64.UnmarshalUnsafe, but for a []Int64.
   583  func UnmarshalUnsafeInt64Slice(dst []Int64, src []byte) []byte {
   584  	count := len(dst)
   585  	if count == 0 {
   586  		return src
   587  	}
   588  	size := (*Int64)(nil).SizeBytes()
   589  
   590  	buf := src[:size*count]
   591  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   592  	return src[size*count:]
   593  }
   594  
   595  // SizeBytes implements marshal.Marshallable.SizeBytes.
   596  //
   597  //go:nosplit
   598  func (i *Int8) SizeBytes() int {
   599  	return 1
   600  }
   601  
   602  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   603  func (i *Int8) MarshalBytes(dst []byte) []byte {
   604  	dst[0] = byte(*i)
   605  	return dst[1:]
   606  }
   607  
   608  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   609  func (i *Int8) UnmarshalBytes(src []byte) []byte {
   610  	*i = Int8(int8(src[0]))
   611  	return src[1:]
   612  }
   613  
   614  // Packed implements marshal.Marshallable.Packed.
   615  //
   616  //go:nosplit
   617  func (i *Int8) Packed() bool {
   618  	// Scalar newtypes are always packed.
   619  	return true
   620  }
   621  
   622  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   623  func (i *Int8) MarshalUnsafe(dst []byte) []byte {
   624  	size := i.SizeBytes()
   625  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   626  	return dst[size:]
   627  }
   628  
   629  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   630  func (i *Int8) UnmarshalUnsafe(src []byte) []byte {
   631  	size := i.SizeBytes()
   632  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   633  	return src[size:]
   634  }
   635  
   636  // CopyOutN implements marshal.Marshallable.CopyOutN.
   637  func (i *Int8) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   638  	// Construct a slice backed by dst's underlying memory.
   639  	var buf []byte
   640  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   641  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   642  	hdr.Len = i.SizeBytes()
   643  	hdr.Cap = i.SizeBytes()
   644  
   645  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   646  	// Since we bypassed the compiler's escape analysis, indicate that i
   647  	// must live until the use above.
   648  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   649  	return length, err
   650  }
   651  
   652  // CopyOut implements marshal.Marshallable.CopyOut.
   653  func (i *Int8) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   654  	return i.CopyOutN(cc, addr, i.SizeBytes())
   655  }
   656  
   657  // CopyIn implements marshal.Marshallable.CopyIn.
   658  func (i *Int8) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   659  	// Construct a slice backed by dst's underlying memory.
   660  	var buf []byte
   661  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   662  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   663  	hdr.Len = i.SizeBytes()
   664  	hdr.Cap = i.SizeBytes()
   665  
   666  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   667  	// Since we bypassed the compiler's escape analysis, indicate that i
   668  	// must live until the use above.
   669  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   670  	return length, err
   671  }
   672  
   673  // WriteTo implements io.WriterTo.WriteTo.
   674  func (i *Int8) WriteTo(writer io.Writer) (int64, error) {
   675  	// Construct a slice backed by dst's underlying memory.
   676  	var buf []byte
   677  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   678  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   679  	hdr.Len = i.SizeBytes()
   680  	hdr.Cap = i.SizeBytes()
   681  
   682  	length, err := writer.Write(buf)
   683  	// Since we bypassed the compiler's escape analysis, indicate that i
   684  	// must live until the use above.
   685  	runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   686  	return int64(length), err
   687  }
   688  
   689  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   690  func (i *Int8) CheckedMarshal(dst []byte) ([]byte, bool) {
   691  	size := i.SizeBytes()
   692  	if size > len(dst) {
   693  		return dst, false
   694  	}
   695  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   696  	return dst[size:], true
   697  }
   698  
   699  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   700  func (i *Int8) CheckedUnmarshal(src []byte) ([]byte, bool) {
   701  	size := i.SizeBytes()
   702  	if size > len(src) {
   703  		return src, false
   704  	}
   705  	gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   706  	return src[size:], true
   707  }
   708  
   709  // CopyInt8SliceIn copies in a slice of int8 objects from the task's memory.
   710  func CopyInt8SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int8) (int, error) {
   711  	count := len(dst)
   712  	if count == 0 {
   713  		return 0, nil
   714  	}
   715  	size := (*Int8)(nil).SizeBytes()
   716  
   717  	ptr := unsafe.Pointer(&dst)
   718  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   719  
   720  	// Construct a slice backed by dst's underlying memory.
   721  	var buf []byte
   722  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   723  	hdr.Data = uintptr(val)
   724  	hdr.Len = size * count
   725  	hdr.Cap = size * count
   726  
   727  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   728  	// Since we bypassed the compiler's escape analysis, indicate that dst
   729  	// must live until the use above.
   730  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   731  	return length, err
   732  }
   733  
   734  // CopyInt8SliceOut copies a slice of int8 objects to the task's memory.
   735  func CopyInt8SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int8) (int, error) {
   736  	count := len(src)
   737  	if count == 0 {
   738  		return 0, nil
   739  	}
   740  	size := (*Int8)(nil).SizeBytes()
   741  
   742  	ptr := unsafe.Pointer(&src)
   743  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   744  
   745  	// Construct a slice backed by dst's underlying memory.
   746  	var buf []byte
   747  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   748  	hdr.Data = uintptr(val)
   749  	hdr.Len = size * count
   750  	hdr.Cap = size * count
   751  
   752  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   753  	// Since we bypassed the compiler's escape analysis, indicate that src
   754  	// must live until the use above.
   755  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   756  	return length, err
   757  }
   758  
   759  // MarshalUnsafeInt8Slice is like Int8.MarshalUnsafe, but for a []Int8.
   760  func MarshalUnsafeInt8Slice(src []Int8, dst []byte) []byte {
   761  	count := len(src)
   762  	if count == 0 {
   763  		return dst
   764  	}
   765  	size := (*Int8)(nil).SizeBytes()
   766  
   767  	buf := dst[:size*count]
   768  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   769  	return dst[size*count:]
   770  }
   771  
   772  // UnmarshalUnsafeInt8Slice is like Int8.UnmarshalUnsafe, but for a []Int8.
   773  func UnmarshalUnsafeInt8Slice(dst []Int8, src []byte) []byte {
   774  	count := len(dst)
   775  	if count == 0 {
   776  		return src
   777  	}
   778  	size := (*Int8)(nil).SizeBytes()
   779  
   780  	buf := src[:size*count]
   781  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   782  	return src[size*count:]
   783  }
   784  
   785  // SizeBytes implements marshal.Marshallable.SizeBytes.
   786  //
   787  //go:nosplit
   788  func (u *Uint16) SizeBytes() int {
   789  	return 2
   790  }
   791  
   792  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   793  func (u *Uint16) MarshalBytes(dst []byte) []byte {
   794  	hostarch.ByteOrder.PutUint16(dst[:2], uint16(*u))
   795  	return dst[2:]
   796  }
   797  
   798  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   799  func (u *Uint16) UnmarshalBytes(src []byte) []byte {
   800  	*u = Uint16(uint16(hostarch.ByteOrder.Uint16(src[:2])))
   801  	return src[2:]
   802  }
   803  
   804  // Packed implements marshal.Marshallable.Packed.
   805  //
   806  //go:nosplit
   807  func (u *Uint16) Packed() bool {
   808  	// Scalar newtypes are always packed.
   809  	return true
   810  }
   811  
   812  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   813  func (u *Uint16) MarshalUnsafe(dst []byte) []byte {
   814  	size := u.SizeBytes()
   815  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
   816  	return dst[size:]
   817  }
   818  
   819  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   820  func (u *Uint16) UnmarshalUnsafe(src []byte) []byte {
   821  	size := u.SizeBytes()
   822  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
   823  	return src[size:]
   824  }
   825  
   826  // CopyOutN implements marshal.Marshallable.CopyOutN.
   827  func (u *Uint16) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   828  	// Construct a slice backed by dst's underlying memory.
   829  	var buf []byte
   830  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   831  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   832  	hdr.Len = u.SizeBytes()
   833  	hdr.Cap = u.SizeBytes()
   834  
   835  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   836  	// Since we bypassed the compiler's escape analysis, indicate that u
   837  	// must live until the use above.
   838  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   839  	return length, err
   840  }
   841  
   842  // CopyOut implements marshal.Marshallable.CopyOut.
   843  func (u *Uint16) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   844  	return u.CopyOutN(cc, addr, u.SizeBytes())
   845  }
   846  
   847  // CopyIn implements marshal.Marshallable.CopyIn.
   848  func (u *Uint16) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   849  	// Construct a slice backed by dst's underlying memory.
   850  	var buf []byte
   851  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   852  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   853  	hdr.Len = u.SizeBytes()
   854  	hdr.Cap = u.SizeBytes()
   855  
   856  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   857  	// Since we bypassed the compiler's escape analysis, indicate that u
   858  	// must live until the use above.
   859  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   860  	return length, err
   861  }
   862  
   863  // WriteTo implements io.WriterTo.WriteTo.
   864  func (u *Uint16) WriteTo(writer io.Writer) (int64, error) {
   865  	// Construct a slice backed by dst's underlying memory.
   866  	var buf []byte
   867  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   868  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   869  	hdr.Len = u.SizeBytes()
   870  	hdr.Cap = u.SizeBytes()
   871  
   872  	length, err := writer.Write(buf)
   873  	// Since we bypassed the compiler's escape analysis, indicate that u
   874  	// must live until the use above.
   875  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   876  	return int64(length), err
   877  }
   878  
   879  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   880  func (u *Uint16) CheckedMarshal(dst []byte) ([]byte, bool) {
   881  	size := u.SizeBytes()
   882  	if size > len(dst) {
   883  		return dst, false
   884  	}
   885  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
   886  	return dst[size:], true
   887  }
   888  
   889  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   890  func (u *Uint16) CheckedUnmarshal(src []byte) ([]byte, bool) {
   891  	size := u.SizeBytes()
   892  	if size > len(src) {
   893  		return src, false
   894  	}
   895  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
   896  	return src[size:], true
   897  }
   898  
   899  // CopyUint16SliceIn copies in a slice of uint16 objects from the task's memory.
   900  func CopyUint16SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint16) (int, error) {
   901  	count := len(dst)
   902  	if count == 0 {
   903  		return 0, nil
   904  	}
   905  	size := (*Uint16)(nil).SizeBytes()
   906  
   907  	ptr := unsafe.Pointer(&dst)
   908  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   909  
   910  	// Construct a slice backed by dst's underlying memory.
   911  	var buf []byte
   912  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   913  	hdr.Data = uintptr(val)
   914  	hdr.Len = size * count
   915  	hdr.Cap = size * count
   916  
   917  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   918  	// Since we bypassed the compiler's escape analysis, indicate that dst
   919  	// must live until the use above.
   920  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   921  	return length, err
   922  }
   923  
   924  // CopyUint16SliceOut copies a slice of uint16 objects to the task's memory.
   925  func CopyUint16SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint16) (int, error) {
   926  	count := len(src)
   927  	if count == 0 {
   928  		return 0, nil
   929  	}
   930  	size := (*Uint16)(nil).SizeBytes()
   931  
   932  	ptr := unsafe.Pointer(&src)
   933  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   934  
   935  	// Construct a slice backed by dst's underlying memory.
   936  	var buf []byte
   937  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   938  	hdr.Data = uintptr(val)
   939  	hdr.Len = size * count
   940  	hdr.Cap = size * count
   941  
   942  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   943  	// Since we bypassed the compiler's escape analysis, indicate that src
   944  	// must live until the use above.
   945  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   946  	return length, err
   947  }
   948  
   949  // MarshalUnsafeUint16Slice is like Uint16.MarshalUnsafe, but for a []Uint16.
   950  func MarshalUnsafeUint16Slice(src []Uint16, dst []byte) []byte {
   951  	count := len(src)
   952  	if count == 0 {
   953  		return dst
   954  	}
   955  	size := (*Uint16)(nil).SizeBytes()
   956  
   957  	buf := dst[:size*count]
   958  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   959  	return dst[size*count:]
   960  }
   961  
   962  // UnmarshalUnsafeUint16Slice is like Uint16.UnmarshalUnsafe, but for a []Uint16.
   963  func UnmarshalUnsafeUint16Slice(dst []Uint16, src []byte) []byte {
   964  	count := len(dst)
   965  	if count == 0 {
   966  		return src
   967  	}
   968  	size := (*Uint16)(nil).SizeBytes()
   969  
   970  	buf := src[:size*count]
   971  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   972  	return src[size*count:]
   973  }
   974  
   975  // SizeBytes implements marshal.Marshallable.SizeBytes.
   976  //
   977  //go:nosplit
   978  func (u *Uint32) SizeBytes() int {
   979  	return 4
   980  }
   981  
   982  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   983  func (u *Uint32) MarshalBytes(dst []byte) []byte {
   984  	hostarch.ByteOrder.PutUint32(dst[:4], uint32(*u))
   985  	return dst[4:]
   986  }
   987  
   988  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   989  func (u *Uint32) UnmarshalBytes(src []byte) []byte {
   990  	*u = Uint32(uint32(hostarch.ByteOrder.Uint32(src[:4])))
   991  	return src[4:]
   992  }
   993  
   994  // Packed implements marshal.Marshallable.Packed.
   995  //
   996  //go:nosplit
   997  func (u *Uint32) Packed() bool {
   998  	// Scalar newtypes are always packed.
   999  	return true
  1000  }
  1001  
  1002  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1003  func (u *Uint32) MarshalUnsafe(dst []byte) []byte {
  1004  	size := u.SizeBytes()
  1005  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1006  	return dst[size:]
  1007  }
  1008  
  1009  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1010  func (u *Uint32) UnmarshalUnsafe(src []byte) []byte {
  1011  	size := u.SizeBytes()
  1012  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1013  	return src[size:]
  1014  }
  1015  
  1016  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1017  func (u *Uint32) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1018  	// Construct a slice backed by dst's underlying memory.
  1019  	var buf []byte
  1020  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1021  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1022  	hdr.Len = u.SizeBytes()
  1023  	hdr.Cap = u.SizeBytes()
  1024  
  1025  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1026  	// Since we bypassed the compiler's escape analysis, indicate that u
  1027  	// must live until the use above.
  1028  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1029  	return length, err
  1030  }
  1031  
  1032  // CopyOut implements marshal.Marshallable.CopyOut.
  1033  func (u *Uint32) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1034  	return u.CopyOutN(cc, addr, u.SizeBytes())
  1035  }
  1036  
  1037  // CopyIn implements marshal.Marshallable.CopyIn.
  1038  func (u *Uint32) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1039  	// Construct a slice backed by dst's underlying memory.
  1040  	var buf []byte
  1041  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1042  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1043  	hdr.Len = u.SizeBytes()
  1044  	hdr.Cap = u.SizeBytes()
  1045  
  1046  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1047  	// Since we bypassed the compiler's escape analysis, indicate that u
  1048  	// must live until the use above.
  1049  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1050  	return length, err
  1051  }
  1052  
  1053  // WriteTo implements io.WriterTo.WriteTo.
  1054  func (u *Uint32) WriteTo(writer io.Writer) (int64, error) {
  1055  	// Construct a slice backed by dst's underlying memory.
  1056  	var buf []byte
  1057  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1058  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1059  	hdr.Len = u.SizeBytes()
  1060  	hdr.Cap = u.SizeBytes()
  1061  
  1062  	length, err := writer.Write(buf)
  1063  	// Since we bypassed the compiler's escape analysis, indicate that u
  1064  	// must live until the use above.
  1065  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1066  	return int64(length), err
  1067  }
  1068  
  1069  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1070  func (u *Uint32) CheckedMarshal(dst []byte) ([]byte, bool) {
  1071  	size := u.SizeBytes()
  1072  	if size > len(dst) {
  1073  		return dst, false
  1074  	}
  1075  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1076  	return dst[size:], true
  1077  }
  1078  
  1079  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1080  func (u *Uint32) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1081  	size := u.SizeBytes()
  1082  	if size > len(src) {
  1083  		return src, false
  1084  	}
  1085  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1086  	return src[size:], true
  1087  }
  1088  
  1089  // CopyUint32SliceIn copies in a slice of uint32 objects from the task's memory.
  1090  func CopyUint32SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint32) (int, error) {
  1091  	count := len(dst)
  1092  	if count == 0 {
  1093  		return 0, nil
  1094  	}
  1095  	size := (*Uint32)(nil).SizeBytes()
  1096  
  1097  	ptr := unsafe.Pointer(&dst)
  1098  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1099  
  1100  	// Construct a slice backed by dst's underlying memory.
  1101  	var buf []byte
  1102  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1103  	hdr.Data = uintptr(val)
  1104  	hdr.Len = size * count
  1105  	hdr.Cap = size * count
  1106  
  1107  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1108  	// Since we bypassed the compiler's escape analysis, indicate that dst
  1109  	// must live until the use above.
  1110  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1111  	return length, err
  1112  }
  1113  
  1114  // CopyUint32SliceOut copies a slice of uint32 objects to the task's memory.
  1115  func CopyUint32SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint32) (int, error) {
  1116  	count := len(src)
  1117  	if count == 0 {
  1118  		return 0, nil
  1119  	}
  1120  	size := (*Uint32)(nil).SizeBytes()
  1121  
  1122  	ptr := unsafe.Pointer(&src)
  1123  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1124  
  1125  	// Construct a slice backed by dst's underlying memory.
  1126  	var buf []byte
  1127  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1128  	hdr.Data = uintptr(val)
  1129  	hdr.Len = size * count
  1130  	hdr.Cap = size * count
  1131  
  1132  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1133  	// Since we bypassed the compiler's escape analysis, indicate that src
  1134  	// must live until the use above.
  1135  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1136  	return length, err
  1137  }
  1138  
  1139  // MarshalUnsafeUint32Slice is like Uint32.MarshalUnsafe, but for a []Uint32.
  1140  func MarshalUnsafeUint32Slice(src []Uint32, dst []byte) []byte {
  1141  	count := len(src)
  1142  	if count == 0 {
  1143  		return dst
  1144  	}
  1145  	size := (*Uint32)(nil).SizeBytes()
  1146  
  1147  	buf := dst[:size*count]
  1148  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1149  	return dst[size*count:]
  1150  }
  1151  
  1152  // UnmarshalUnsafeUint32Slice is like Uint32.UnmarshalUnsafe, but for a []Uint32.
  1153  func UnmarshalUnsafeUint32Slice(dst []Uint32, src []byte) []byte {
  1154  	count := len(dst)
  1155  	if count == 0 {
  1156  		return src
  1157  	}
  1158  	size := (*Uint32)(nil).SizeBytes()
  1159  
  1160  	buf := src[:size*count]
  1161  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1162  	return src[size*count:]
  1163  }
  1164  
  1165  // SizeBytes implements marshal.Marshallable.SizeBytes.
  1166  //
  1167  //go:nosplit
  1168  func (u *Uint64) SizeBytes() int {
  1169  	return 8
  1170  }
  1171  
  1172  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
  1173  func (u *Uint64) MarshalBytes(dst []byte) []byte {
  1174  	hostarch.ByteOrder.PutUint64(dst[:8], uint64(*u))
  1175  	return dst[8:]
  1176  }
  1177  
  1178  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
  1179  func (u *Uint64) UnmarshalBytes(src []byte) []byte {
  1180  	*u = Uint64(uint64(hostarch.ByteOrder.Uint64(src[:8])))
  1181  	return src[8:]
  1182  }
  1183  
  1184  // Packed implements marshal.Marshallable.Packed.
  1185  //
  1186  //go:nosplit
  1187  func (u *Uint64) Packed() bool {
  1188  	// Scalar newtypes are always packed.
  1189  	return true
  1190  }
  1191  
  1192  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1193  func (u *Uint64) MarshalUnsafe(dst []byte) []byte {
  1194  	size := u.SizeBytes()
  1195  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1196  	return dst[size:]
  1197  }
  1198  
  1199  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1200  func (u *Uint64) UnmarshalUnsafe(src []byte) []byte {
  1201  	size := u.SizeBytes()
  1202  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1203  	return src[size:]
  1204  }
  1205  
  1206  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1207  func (u *Uint64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1208  	// Construct a slice backed by dst's underlying memory.
  1209  	var buf []byte
  1210  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1211  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1212  	hdr.Len = u.SizeBytes()
  1213  	hdr.Cap = u.SizeBytes()
  1214  
  1215  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1216  	// Since we bypassed the compiler's escape analysis, indicate that u
  1217  	// must live until the use above.
  1218  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1219  	return length, err
  1220  }
  1221  
  1222  // CopyOut implements marshal.Marshallable.CopyOut.
  1223  func (u *Uint64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1224  	return u.CopyOutN(cc, addr, u.SizeBytes())
  1225  }
  1226  
  1227  // CopyIn implements marshal.Marshallable.CopyIn.
  1228  func (u *Uint64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1229  	// Construct a slice backed by dst's underlying memory.
  1230  	var buf []byte
  1231  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1232  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1233  	hdr.Len = u.SizeBytes()
  1234  	hdr.Cap = u.SizeBytes()
  1235  
  1236  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1237  	// Since we bypassed the compiler's escape analysis, indicate that u
  1238  	// must live until the use above.
  1239  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1240  	return length, err
  1241  }
  1242  
  1243  // WriteTo implements io.WriterTo.WriteTo.
  1244  func (u *Uint64) WriteTo(writer io.Writer) (int64, error) {
  1245  	// Construct a slice backed by dst's underlying memory.
  1246  	var buf []byte
  1247  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1248  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1249  	hdr.Len = u.SizeBytes()
  1250  	hdr.Cap = u.SizeBytes()
  1251  
  1252  	length, err := writer.Write(buf)
  1253  	// Since we bypassed the compiler's escape analysis, indicate that u
  1254  	// must live until the use above.
  1255  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1256  	return int64(length), err
  1257  }
  1258  
  1259  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1260  func (u *Uint64) CheckedMarshal(dst []byte) ([]byte, bool) {
  1261  	size := u.SizeBytes()
  1262  	if size > len(dst) {
  1263  		return dst, false
  1264  	}
  1265  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1266  	return dst[size:], true
  1267  }
  1268  
  1269  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1270  func (u *Uint64) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1271  	size := u.SizeBytes()
  1272  	if size > len(src) {
  1273  		return src, false
  1274  	}
  1275  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1276  	return src[size:], true
  1277  }
  1278  
  1279  // CopyUint64SliceIn copies in a slice of uint64 objects from the task's memory.
  1280  func CopyUint64SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint64) (int, error) {
  1281  	count := len(dst)
  1282  	if count == 0 {
  1283  		return 0, nil
  1284  	}
  1285  	size := (*Uint64)(nil).SizeBytes()
  1286  
  1287  	ptr := unsafe.Pointer(&dst)
  1288  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1289  
  1290  	// Construct a slice backed by dst's underlying memory.
  1291  	var buf []byte
  1292  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1293  	hdr.Data = uintptr(val)
  1294  	hdr.Len = size * count
  1295  	hdr.Cap = size * count
  1296  
  1297  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1298  	// Since we bypassed the compiler's escape analysis, indicate that dst
  1299  	// must live until the use above.
  1300  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1301  	return length, err
  1302  }
  1303  
  1304  // CopyUint64SliceOut copies a slice of uint64 objects to the task's memory.
  1305  func CopyUint64SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint64) (int, error) {
  1306  	count := len(src)
  1307  	if count == 0 {
  1308  		return 0, nil
  1309  	}
  1310  	size := (*Uint64)(nil).SizeBytes()
  1311  
  1312  	ptr := unsafe.Pointer(&src)
  1313  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1314  
  1315  	// Construct a slice backed by dst's underlying memory.
  1316  	var buf []byte
  1317  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1318  	hdr.Data = uintptr(val)
  1319  	hdr.Len = size * count
  1320  	hdr.Cap = size * count
  1321  
  1322  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1323  	// Since we bypassed the compiler's escape analysis, indicate that src
  1324  	// must live until the use above.
  1325  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1326  	return length, err
  1327  }
  1328  
  1329  // MarshalUnsafeUint64Slice is like Uint64.MarshalUnsafe, but for a []Uint64.
  1330  func MarshalUnsafeUint64Slice(src []Uint64, dst []byte) []byte {
  1331  	count := len(src)
  1332  	if count == 0 {
  1333  		return dst
  1334  	}
  1335  	size := (*Uint64)(nil).SizeBytes()
  1336  
  1337  	buf := dst[:size*count]
  1338  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1339  	return dst[size*count:]
  1340  }
  1341  
  1342  // UnmarshalUnsafeUint64Slice is like Uint64.UnmarshalUnsafe, but for a []Uint64.
  1343  func UnmarshalUnsafeUint64Slice(dst []Uint64, src []byte) []byte {
  1344  	count := len(dst)
  1345  	if count == 0 {
  1346  		return src
  1347  	}
  1348  	size := (*Uint64)(nil).SizeBytes()
  1349  
  1350  	buf := src[:size*count]
  1351  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1352  	return src[size*count:]
  1353  }
  1354  
  1355  // SizeBytes implements marshal.Marshallable.SizeBytes.
  1356  //
  1357  //go:nosplit
  1358  func (u *Uint8) SizeBytes() int {
  1359  	return 1
  1360  }
  1361  
  1362  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
  1363  func (u *Uint8) MarshalBytes(dst []byte) []byte {
  1364  	dst[0] = byte(*u)
  1365  	return dst[1:]
  1366  }
  1367  
  1368  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
  1369  func (u *Uint8) UnmarshalBytes(src []byte) []byte {
  1370  	*u = Uint8(uint8(src[0]))
  1371  	return src[1:]
  1372  }
  1373  
  1374  // Packed implements marshal.Marshallable.Packed.
  1375  //
  1376  //go:nosplit
  1377  func (u *Uint8) Packed() bool {
  1378  	// Scalar newtypes are always packed.
  1379  	return true
  1380  }
  1381  
  1382  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1383  func (u *Uint8) MarshalUnsafe(dst []byte) []byte {
  1384  	size := u.SizeBytes()
  1385  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1386  	return dst[size:]
  1387  }
  1388  
  1389  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1390  func (u *Uint8) UnmarshalUnsafe(src []byte) []byte {
  1391  	size := u.SizeBytes()
  1392  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1393  	return src[size:]
  1394  }
  1395  
  1396  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1397  func (u *Uint8) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1398  	// Construct a slice backed by dst's underlying memory.
  1399  	var buf []byte
  1400  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1401  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1402  	hdr.Len = u.SizeBytes()
  1403  	hdr.Cap = u.SizeBytes()
  1404  
  1405  	length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1406  	// Since we bypassed the compiler's escape analysis, indicate that u
  1407  	// must live until the use above.
  1408  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1409  	return length, err
  1410  }
  1411  
  1412  // CopyOut implements marshal.Marshallable.CopyOut.
  1413  func (u *Uint8) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1414  	return u.CopyOutN(cc, addr, u.SizeBytes())
  1415  }
  1416  
  1417  // CopyIn implements marshal.Marshallable.CopyIn.
  1418  func (u *Uint8) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1419  	// Construct a slice backed by dst's underlying memory.
  1420  	var buf []byte
  1421  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1422  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1423  	hdr.Len = u.SizeBytes()
  1424  	hdr.Cap = u.SizeBytes()
  1425  
  1426  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1427  	// Since we bypassed the compiler's escape analysis, indicate that u
  1428  	// must live until the use above.
  1429  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1430  	return length, err
  1431  }
  1432  
  1433  // WriteTo implements io.WriterTo.WriteTo.
  1434  func (u *Uint8) WriteTo(writer io.Writer) (int64, error) {
  1435  	// Construct a slice backed by dst's underlying memory.
  1436  	var buf []byte
  1437  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1438  	hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1439  	hdr.Len = u.SizeBytes()
  1440  	hdr.Cap = u.SizeBytes()
  1441  
  1442  	length, err := writer.Write(buf)
  1443  	// Since we bypassed the compiler's escape analysis, indicate that u
  1444  	// must live until the use above.
  1445  	runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1446  	return int64(length), err
  1447  }
  1448  
  1449  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1450  func (u *Uint8) CheckedMarshal(dst []byte) ([]byte, bool) {
  1451  	size := u.SizeBytes()
  1452  	if size > len(dst) {
  1453  		return dst, false
  1454  	}
  1455  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1456  	return dst[size:], true
  1457  }
  1458  
  1459  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1460  func (u *Uint8) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1461  	size := u.SizeBytes()
  1462  	if size > len(src) {
  1463  		return src, false
  1464  	}
  1465  	gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1466  	return src[size:], true
  1467  }
  1468  
  1469  // CopyUint8SliceIn copies in a slice of uint8 objects from the task's memory.
  1470  func CopyUint8SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint8) (int, error) {
  1471  	count := len(dst)
  1472  	if count == 0 {
  1473  		return 0, nil
  1474  	}
  1475  	size := (*Uint8)(nil).SizeBytes()
  1476  
  1477  	ptr := unsafe.Pointer(&dst)
  1478  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1479  
  1480  	// Construct a slice backed by dst's underlying memory.
  1481  	var buf []byte
  1482  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1483  	hdr.Data = uintptr(val)
  1484  	hdr.Len = size * count
  1485  	hdr.Cap = size * count
  1486  
  1487  	length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1488  	// Since we bypassed the compiler's escape analysis, indicate that dst
  1489  	// must live until the use above.
  1490  	runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1491  	return length, err
  1492  }
  1493  
  1494  // CopyUint8SliceOut copies a slice of uint8 objects to the task's memory.
  1495  func CopyUint8SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint8) (int, error) {
  1496  	count := len(src)
  1497  	if count == 0 {
  1498  		return 0, nil
  1499  	}
  1500  	size := (*Uint8)(nil).SizeBytes()
  1501  
  1502  	ptr := unsafe.Pointer(&src)
  1503  	val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1504  
  1505  	// Construct a slice backed by dst's underlying memory.
  1506  	var buf []byte
  1507  	hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1508  	hdr.Data = uintptr(val)
  1509  	hdr.Len = size * count
  1510  	hdr.Cap = size * count
  1511  
  1512  	length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1513  	// Since we bypassed the compiler's escape analysis, indicate that src
  1514  	// must live until the use above.
  1515  	runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1516  	return length, err
  1517  }
  1518  
  1519  // MarshalUnsafeUint8Slice is like Uint8.MarshalUnsafe, but for a []Uint8.
  1520  func MarshalUnsafeUint8Slice(src []Uint8, dst []byte) []byte {
  1521  	count := len(src)
  1522  	if count == 0 {
  1523  		return dst
  1524  	}
  1525  	size := (*Uint8)(nil).SizeBytes()
  1526  
  1527  	buf := dst[:size*count]
  1528  	gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1529  	return dst[size*count:]
  1530  }
  1531  
  1532  // UnmarshalUnsafeUint8Slice is like Uint8.UnmarshalUnsafe, but for a []Uint8.
  1533  func UnmarshalUnsafeUint8Slice(dst []Uint8, src []byte) []byte {
  1534  	count := len(dst)
  1535  	if count == 0 {
  1536  		return src
  1537  	}
  1538  	size := (*Uint8)(nil).SizeBytes()
  1539  
  1540  	buf := src[:size*count]
  1541  	gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1542  	return src[size*count:]
  1543  }