| 1 |
// Code generated by 'tmplgen'; DO NOT EDIT. |
| 2 |
|
| 3 |
//go:build goexperiment.simd |
| 4 |
|
| 5 |
package archsimd |
| 6 |
|
| 7 |
import "unsafe" |
| 8 |
|
| 9 |
// LoadInt8x16Slice loads an Int8x16 from a slice of at least 16 int8s. |
| 10 |
func LoadInt8x16Slice(s []int8) Int8x16 { |
| 11 |
return LoadInt8x16((*[16]int8)(s)) |
| 12 |
} |
| 13 |
|
| 14 |
// StoreSlice stores x into a slice of at least 16 int8s. |
| 15 |
func (x Int8x16) StoreSlice(s []int8) { |
| 16 |
x.Store((*[16]int8)(s)) |
| 17 |
} |
| 18 |
|
| 19 |
// LoadInt16x8Slice loads an Int16x8 from a slice of at least 8 int16s. |
| 20 |
func LoadInt16x8Slice(s []int16) Int16x8 { |
| 21 |
return LoadInt16x8((*[8]int16)(s)) |
| 22 |
} |
| 23 |
|
| 24 |
// StoreSlice stores x into a slice of at least 8 int16s. |
| 25 |
func (x Int16x8) StoreSlice(s []int16) { |
| 26 |
x.Store((*[8]int16)(s)) |
| 27 |
} |
| 28 |
|
| 29 |
// LoadInt32x4Slice loads an Int32x4 from a slice of at least 4 int32s. |
| 30 |
func LoadInt32x4Slice(s []int32) Int32x4 { |
| 31 |
return LoadInt32x4((*[4]int32)(s)) |
| 32 |
} |
| 33 |
|
| 34 |
// StoreSlice stores x into a slice of at least 4 int32s. |
| 35 |
func (x Int32x4) StoreSlice(s []int32) { |
| 36 |
x.Store((*[4]int32)(s)) |
| 37 |
} |
| 38 |
|
| 39 |
// LoadInt64x2Slice loads an Int64x2 from a slice of at least 2 int64s. |
| 40 |
func LoadInt64x2Slice(s []int64) Int64x2 { |
| 41 |
return LoadInt64x2((*[2]int64)(s)) |
| 42 |
} |
| 43 |
|
| 44 |
// StoreSlice stores x into a slice of at least 2 int64s. |
| 45 |
func (x Int64x2) StoreSlice(s []int64) { |
| 46 |
x.Store((*[2]int64)(s)) |
| 47 |
} |
| 48 |
|
| 49 |
// LoadUint8x16Slice loads an Uint8x16 from a slice of at least 16 uint8s. |
| 50 |
func LoadUint8x16Slice(s []uint8) Uint8x16 { |
| 51 |
return LoadUint8x16((*[16]uint8)(s)) |
| 52 |
} |
| 53 |
|
| 54 |
// StoreSlice stores x into a slice of at least 16 uint8s. |
| 55 |
func (x Uint8x16) StoreSlice(s []uint8) { |
| 56 |
x.Store((*[16]uint8)(s)) |
| 57 |
} |
| 58 |
|
| 59 |
// LoadUint16x8Slice loads an Uint16x8 from a slice of at least 8 uint16s. |
| 60 |
func LoadUint16x8Slice(s []uint16) Uint16x8 { |
| 61 |
return LoadUint16x8((*[8]uint16)(s)) |
| 62 |
} |
| 63 |
|
| 64 |
// StoreSlice stores x into a slice of at least 8 uint16s. |
| 65 |
func (x Uint16x8) StoreSlice(s []uint16) { |
| 66 |
x.Store((*[8]uint16)(s)) |
| 67 |
} |
| 68 |
|
| 69 |
// LoadUint32x4Slice loads an Uint32x4 from a slice of at least 4 uint32s. |
| 70 |
func LoadUint32x4Slice(s []uint32) Uint32x4 { |
| 71 |
return LoadUint32x4((*[4]uint32)(s)) |
| 72 |
} |
| 73 |
|
| 74 |
// StoreSlice stores x into a slice of at least 4 uint32s. |
| 75 |
func (x Uint32x4) StoreSlice(s []uint32) { |
| 76 |
x.Store((*[4]uint32)(s)) |
| 77 |
} |
| 78 |
|
| 79 |
// LoadUint64x2Slice loads an Uint64x2 from a slice of at least 2 uint64s. |
| 80 |
func LoadUint64x2Slice(s []uint64) Uint64x2 { |
| 81 |
return LoadUint64x2((*[2]uint64)(s)) |
| 82 |
} |
| 83 |
|
| 84 |
// StoreSlice stores x into a slice of at least 2 uint64s. |
| 85 |
func (x Uint64x2) StoreSlice(s []uint64) { |
| 86 |
x.Store((*[2]uint64)(s)) |
| 87 |
} |
| 88 |
|
| 89 |
// LoadFloat32x4Slice loads a Float32x4 from a slice of at least 4 float32s. |
| 90 |
func LoadFloat32x4Slice(s []float32) Float32x4 { |
| 91 |
return LoadFloat32x4((*[4]float32)(s)) |
| 92 |
} |
| 93 |
|
| 94 |
// StoreSlice stores x into a slice of at least 4 float32s. |
| 95 |
func (x Float32x4) StoreSlice(s []float32) { |
| 96 |
x.Store((*[4]float32)(s)) |
| 97 |
} |
| 98 |
|
| 99 |
// LoadFloat64x2Slice loads a Float64x2 from a slice of at least 2 float64s. |
| 100 |
func LoadFloat64x2Slice(s []float64) Float64x2 { |
| 101 |
return LoadFloat64x2((*[2]float64)(s)) |
| 102 |
} |
| 103 |
|
| 104 |
// StoreSlice stores x into a slice of at least 2 float64s. |
| 105 |
func (x Float64x2) StoreSlice(s []float64) { |
| 106 |
x.Store((*[2]float64)(s)) |
| 107 |
} |
| 108 |
|
| 109 |
// LoadInt8x32Slice loads an Int8x32 from a slice of at least 32 int8s. |
| 110 |
func LoadInt8x32Slice(s []int8) Int8x32 { |
| 111 |
return LoadInt8x32((*[32]int8)(s)) |
| 112 |
} |
| 113 |
|
| 114 |
// StoreSlice stores x into a slice of at least 32 int8s. |
| 115 |
func (x Int8x32) StoreSlice(s []int8) { |
| 116 |
x.Store((*[32]int8)(s)) |
| 117 |
} |
| 118 |
|
| 119 |
// LoadInt16x16Slice loads an Int16x16 from a slice of at least 16 int16s. |
| 120 |
func LoadInt16x16Slice(s []int16) Int16x16 { |
| 121 |
return LoadInt16x16((*[16]int16)(s)) |
| 122 |
} |
| 123 |
|
| 124 |
// StoreSlice stores x into a slice of at least 16 int16s. |
| 125 |
func (x Int16x16) StoreSlice(s []int16) { |
| 126 |
x.Store((*[16]int16)(s)) |
| 127 |
} |
| 128 |
|
| 129 |
// LoadInt32x8Slice loads an Int32x8 from a slice of at least 8 int32s. |
| 130 |
func LoadInt32x8Slice(s []int32) Int32x8 { |
| 131 |
return LoadInt32x8((*[8]int32)(s)) |
| 132 |
} |
| 133 |
|
| 134 |
// StoreSlice stores x into a slice of at least 8 int32s. |
| 135 |
func (x Int32x8) StoreSlice(s []int32) { |
| 136 |
x.Store((*[8]int32)(s)) |
| 137 |
} |
| 138 |
|
| 139 |
// LoadInt64x4Slice loads an Int64x4 from a slice of at least 4 int64s. |
| 140 |
func LoadInt64x4Slice(s []int64) Int64x4 { |
| 141 |
return LoadInt64x4((*[4]int64)(s)) |
| 142 |
} |
| 143 |
|
| 144 |
// StoreSlice stores x into a slice of at least 4 int64s. |
| 145 |
func (x Int64x4) StoreSlice(s []int64) { |
| 146 |
x.Store((*[4]int64)(s)) |
| 147 |
} |
| 148 |
|
| 149 |
// LoadUint8x32Slice loads an Uint8x32 from a slice of at least 32 uint8s. |
| 150 |
func LoadUint8x32Slice(s []uint8) Uint8x32 { |
| 151 |
return LoadUint8x32((*[32]uint8)(s)) |
| 152 |
} |
| 153 |
|
| 154 |
// StoreSlice stores x into a slice of at least 32 uint8s. |
| 155 |
func (x Uint8x32) StoreSlice(s []uint8) { |
| 156 |
x.Store((*[32]uint8)(s)) |
| 157 |
} |
| 158 |
|
| 159 |
// LoadUint16x16Slice loads an Uint16x16 from a slice of at least 16 uint16s. |
| 160 |
func LoadUint16x16Slice(s []uint16) Uint16x16 { |
| 161 |
return LoadUint16x16((*[16]uint16)(s)) |
| 162 |
} |
| 163 |
|
| 164 |
// StoreSlice stores x into a slice of at least 16 uint16s. |
| 165 |
func (x Uint16x16) StoreSlice(s []uint16) { |
| 166 |
x.Store((*[16]uint16)(s)) |
| 167 |
} |
| 168 |
|
| 169 |
// LoadUint32x8Slice loads an Uint32x8 from a slice of at least 8 uint32s. |
| 170 |
func LoadUint32x8Slice(s []uint32) Uint32x8 { |
| 171 |
return LoadUint32x8((*[8]uint32)(s)) |
| 172 |
} |
| 173 |
|
| 174 |
// StoreSlice stores x into a slice of at least 8 uint32s. |
| 175 |
func (x Uint32x8) StoreSlice(s []uint32) { |
| 176 |
x.Store((*[8]uint32)(s)) |
| 177 |
} |
| 178 |
|
| 179 |
// LoadUint64x4Slice loads an Uint64x4 from a slice of at least 4 uint64s. |
| 180 |
func LoadUint64x4Slice(s []uint64) Uint64x4 { |
| 181 |
return LoadUint64x4((*[4]uint64)(s)) |
| 182 |
} |
| 183 |
|
| 184 |
// StoreSlice stores x into a slice of at least 4 uint64s. |
| 185 |
func (x Uint64x4) StoreSlice(s []uint64) { |
| 186 |
x.Store((*[4]uint64)(s)) |
| 187 |
} |
| 188 |
|
| 189 |
// LoadFloat32x8Slice loads a Float32x8 from a slice of at least 8 float32s. |
| 190 |
func LoadFloat32x8Slice(s []float32) Float32x8 { |
| 191 |
return LoadFloat32x8((*[8]float32)(s)) |
| 192 |
} |
| 193 |
|
| 194 |
// StoreSlice stores x into a slice of at least 8 float32s. |
| 195 |
func (x Float32x8) StoreSlice(s []float32) { |
| 196 |
x.Store((*[8]float32)(s)) |
| 197 |
} |
| 198 |
|
| 199 |
// LoadFloat64x4Slice loads a Float64x4 from a slice of at least 4 float64s. |
| 200 |
func LoadFloat64x4Slice(s []float64) Float64x4 { |
| 201 |
return LoadFloat64x4((*[4]float64)(s)) |
| 202 |
} |
| 203 |
|
| 204 |
// StoreSlice stores x into a slice of at least 4 float64s. |
| 205 |
func (x Float64x4) StoreSlice(s []float64) { |
| 206 |
x.Store((*[4]float64)(s)) |
| 207 |
} |
| 208 |
|
| 209 |
// LoadInt8x64Slice loads an Int8x64 from a slice of at least 64 int8s. |
| 210 |
func LoadInt8x64Slice(s []int8) Int8x64 { |
| 211 |
return LoadInt8x64((*[64]int8)(s)) |
| 212 |
} |
| 213 |
|
| 214 |
// StoreSlice stores x into a slice of at least 64 int8s. |
| 215 |
func (x Int8x64) StoreSlice(s []int8) { |
| 216 |
x.Store((*[64]int8)(s)) |
| 217 |
} |
| 218 |
|
| 219 |
// LoadInt16x32Slice loads an Int16x32 from a slice of at least 32 int16s. |
| 220 |
func LoadInt16x32Slice(s []int16) Int16x32 { |
| 221 |
return LoadInt16x32((*[32]int16)(s)) |
| 222 |
} |
| 223 |
|
| 224 |
// StoreSlice stores x into a slice of at least 32 int16s. |
| 225 |
func (x Int16x32) StoreSlice(s []int16) { |
| 226 |
x.Store((*[32]int16)(s)) |
| 227 |
} |
| 228 |
|
| 229 |
// LoadInt32x16Slice loads an Int32x16 from a slice of at least 16 int32s. |
| 230 |
func LoadInt32x16Slice(s []int32) Int32x16 { |
| 231 |
return LoadInt32x16((*[16]int32)(s)) |
| 232 |
} |
| 233 |
|
| 234 |
// StoreSlice stores x into a slice of at least 16 int32s. |
| 235 |
func (x Int32x16) StoreSlice(s []int32) { |
| 236 |
x.Store((*[16]int32)(s)) |
| 237 |
} |
| 238 |
|
| 239 |
// LoadInt64x8Slice loads an Int64x8 from a slice of at least 8 int64s. |
| 240 |
func LoadInt64x8Slice(s []int64) Int64x8 { |
| 241 |
return LoadInt64x8((*[8]int64)(s)) |
| 242 |
} |
| 243 |
|
| 244 |
// StoreSlice stores x into a slice of at least 8 int64s. |
| 245 |
func (x Int64x8) StoreSlice(s []int64) { |
| 246 |
x.Store((*[8]int64)(s)) |
| 247 |
} |
| 248 |
|
| 249 |
// LoadUint8x64Slice loads an Uint8x64 from a slice of at least 64 uint8s. |
| 250 |
func LoadUint8x64Slice(s []uint8) Uint8x64 { |
| 251 |
return LoadUint8x64((*[64]uint8)(s)) |
| 252 |
} |
| 253 |
|
| 254 |
// StoreSlice stores x into a slice of at least 64 uint8s. |
| 255 |
func (x Uint8x64) StoreSlice(s []uint8) { |
| 256 |
x.Store((*[64]uint8)(s)) |
| 257 |
} |
| 258 |
|
| 259 |
// LoadUint16x32Slice loads an Uint16x32 from a slice of at least 32 uint16s. |
| 260 |
func LoadUint16x32Slice(s []uint16) Uint16x32 { |
| 261 |
return LoadUint16x32((*[32]uint16)(s)) |
| 262 |
} |
| 263 |
|
| 264 |
// StoreSlice stores x into a slice of at least 32 uint16s. |
| 265 |
func (x Uint16x32) StoreSlice(s []uint16) { |
| 266 |
x.Store((*[32]uint16)(s)) |
| 267 |
} |
| 268 |
|
| 269 |
// LoadUint32x16Slice loads an Uint32x16 from a slice of at least 16 uint32s. |
| 270 |
func LoadUint32x16Slice(s []uint32) Uint32x16 { |
| 271 |
return LoadUint32x16((*[16]uint32)(s)) |
| 272 |
} |
| 273 |
|
| 274 |
// StoreSlice stores x into a slice of at least 16 uint32s. |
| 275 |
func (x Uint32x16) StoreSlice(s []uint32) { |
| 276 |
x.Store((*[16]uint32)(s)) |
| 277 |
} |
| 278 |
|
| 279 |
// LoadUint64x8Slice loads an Uint64x8 from a slice of at least 8 uint64s. |
| 280 |
func LoadUint64x8Slice(s []uint64) Uint64x8 { |
| 281 |
return LoadUint64x8((*[8]uint64)(s)) |
| 282 |
} |
| 283 |
|
| 284 |
// StoreSlice stores x into a slice of at least 8 uint64s. |
| 285 |
func (x Uint64x8) StoreSlice(s []uint64) { |
| 286 |
x.Store((*[8]uint64)(s)) |
| 287 |
} |
| 288 |
|
| 289 |
// LoadFloat32x16Slice loads a Float32x16 from a slice of at least 16 float32s. |
| 290 |
func LoadFloat32x16Slice(s []float32) Float32x16 { |
| 291 |
return LoadFloat32x16((*[16]float32)(s)) |
| 292 |
} |
| 293 |
|
| 294 |
// StoreSlice stores x into a slice of at least 16 float32s. |
| 295 |
func (x Float32x16) StoreSlice(s []float32) { |
| 296 |
x.Store((*[16]float32)(s)) |
| 297 |
} |
| 298 |
|
| 299 |
// LoadFloat64x8Slice loads a Float64x8 from a slice of at least 8 float64s. |
| 300 |
func LoadFloat64x8Slice(s []float64) Float64x8 { |
| 301 |
return LoadFloat64x8((*[8]float64)(s)) |
| 302 |
} |
| 303 |
|
| 304 |
// StoreSlice stores x into a slice of at least 8 float64s. |
| 305 |
func (x Float64x8) StoreSlice(s []float64) { |
| 306 |
x.Store((*[8]float64)(s)) |
| 307 |
} |
| 308 |
|
| 309 |
// LoadInt8x64SlicePart loads a Int8x64 from the slice s. |
| 310 |
// If s has fewer than 64 elements, the remaining elements of the vector are filled with zeroes. |
| 311 |
// If s has 64 or more elements, the function is equivalent to LoadInt8x64Slice. |
| 312 |
func LoadInt8x64SlicePart(s []int8) Int8x64 { |
| 313 |
l := len(s) |
| 314 |
if l >= 64 { |
| 315 |
return LoadInt8x64Slice(s) |
| 316 |
} |
| 317 |
if l == 0 { |
| 318 |
var x Int8x64 |
| 319 |
return x |
| 320 |
} |
| 321 |
mask := Mask8x64FromBits(0xffffffffffffffff >> (64 - l)) |
| 322 |
return LoadMaskedInt8x64(paInt8x64(s), mask) |
| 323 |
} |
| 324 |
|
| 325 |
// StoreSlicePart stores the 64 elements of x into the slice s. |
| 326 |
// It stores as many elements as will fit in s. |
| 327 |
// If s has 64 or more elements, the method is equivalent to x.StoreSlice. |
| 328 |
func (x Int8x64) StoreSlicePart(s []int8) { |
| 329 |
l := len(s) |
| 330 |
if l >= 64 { |
| 331 |
x.StoreSlice(s) |
| 332 |
return |
| 333 |
} |
| 334 |
if l == 0 { |
| 335 |
return |
| 336 |
} |
| 337 |
mask := Mask8x64FromBits(0xffffffffffffffff >> (64 - l)) |
| 338 |
x.StoreMasked(paInt8x64(s), mask) |
| 339 |
} |
| 340 |
|
| 341 |
// LoadInt16x32SlicePart loads a Int16x32 from the slice s. |
| 342 |
// If s has fewer than 32 elements, the remaining elements of the vector are filled with zeroes. |
| 343 |
// If s has 32 or more elements, the function is equivalent to LoadInt16x32Slice. |
| 344 |
func LoadInt16x32SlicePart(s []int16) Int16x32 { |
| 345 |
l := len(s) |
| 346 |
if l >= 32 { |
| 347 |
return LoadInt16x32Slice(s) |
| 348 |
} |
| 349 |
if l == 0 { |
| 350 |
var x Int16x32 |
| 351 |
return x |
| 352 |
} |
| 353 |
mask := Mask16x32FromBits(0xffffffff >> (32 - l)) |
| 354 |
return LoadMaskedInt16x32(paInt16x32(s), mask) |
| 355 |
} |
| 356 |
|
| 357 |
// StoreSlicePart stores the 32 elements of x into the slice s. |
| 358 |
// It stores as many elements as will fit in s. |
| 359 |
// If s has 32 or more elements, the method is equivalent to x.StoreSlice. |
| 360 |
func (x Int16x32) StoreSlicePart(s []int16) { |
| 361 |
l := len(s) |
| 362 |
if l >= 32 { |
| 363 |
x.StoreSlice(s) |
| 364 |
return |
| 365 |
} |
| 366 |
if l == 0 { |
| 367 |
return |
| 368 |
} |
| 369 |
mask := Mask16x32FromBits(0xffffffff >> (32 - l)) |
| 370 |
x.StoreMasked(paInt16x32(s), mask) |
| 371 |
} |
| 372 |
|
| 373 |
// LoadInt32x16SlicePart loads a Int32x16 from the slice s. |
| 374 |
// If s has fewer than 16 elements, the remaining elements of the vector are filled with zeroes. |
| 375 |
// If s has 16 or more elements, the function is equivalent to LoadInt32x16Slice. |
| 376 |
func LoadInt32x16SlicePart(s []int32) Int32x16 { |
| 377 |
l := len(s) |
| 378 |
if l >= 16 { |
| 379 |
return LoadInt32x16Slice(s) |
| 380 |
} |
| 381 |
if l == 0 { |
| 382 |
var x Int32x16 |
| 383 |
return x |
| 384 |
} |
| 385 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 386 |
return LoadMaskedInt32x16(paInt32x16(s), mask) |
| 387 |
} |
| 388 |
|
| 389 |
// StoreSlicePart stores the 16 elements of x into the slice s. |
| 390 |
// It stores as many elements as will fit in s. |
| 391 |
// If s has 16 or more elements, the method is equivalent to x.StoreSlice. |
| 392 |
func (x Int32x16) StoreSlicePart(s []int32) { |
| 393 |
l := len(s) |
| 394 |
if l >= 16 { |
| 395 |
x.StoreSlice(s) |
| 396 |
return |
| 397 |
} |
| 398 |
if l == 0 { |
| 399 |
return |
| 400 |
} |
| 401 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 402 |
x.StoreMasked(paInt32x16(s), mask) |
| 403 |
} |
| 404 |
|
| 405 |
// LoadInt64x8SlicePart loads a Int64x8 from the slice s. |
| 406 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 407 |
// If s has 8 or more elements, the function is equivalent to LoadInt64x8Slice. |
| 408 |
func LoadInt64x8SlicePart(s []int64) Int64x8 { |
| 409 |
l := len(s) |
| 410 |
if l >= 8 { |
| 411 |
return LoadInt64x8Slice(s) |
| 412 |
} |
| 413 |
if l == 0 { |
| 414 |
var x Int64x8 |
| 415 |
return x |
| 416 |
} |
| 417 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 418 |
return LoadMaskedInt64x8(paInt64x8(s), mask) |
| 419 |
} |
| 420 |
|
| 421 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 422 |
// It stores as many elements as will fit in s. |
| 423 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 424 |
func (x Int64x8) StoreSlicePart(s []int64) { |
| 425 |
l := len(s) |
| 426 |
if l >= 8 { |
| 427 |
x.StoreSlice(s) |
| 428 |
return |
| 429 |
} |
| 430 |
if l == 0 { |
| 431 |
return |
| 432 |
} |
| 433 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 434 |
x.StoreMasked(paInt64x8(s), mask) |
| 435 |
} |
| 436 |
|
| 437 |
// LoadUint8x64SlicePart loads a Uint8x64 from the slice s. |
| 438 |
// If s has fewer than 64 elements, the remaining elements of the vector are filled with zeroes. |
| 439 |
// If s has 64 or more elements, the function is equivalent to LoadUint8x64Slice. |
| 440 |
func LoadUint8x64SlicePart(s []uint8) Uint8x64 { |
| 441 |
l := len(s) |
| 442 |
if l >= 64 { |
| 443 |
return LoadUint8x64Slice(s) |
| 444 |
} |
| 445 |
if l == 0 { |
| 446 |
var x Uint8x64 |
| 447 |
return x |
| 448 |
} |
| 449 |
mask := Mask8x64FromBits(0xffffffffffffffff >> (64 - l)) |
| 450 |
return LoadMaskedUint8x64(paUint8x64(s), mask) |
| 451 |
} |
| 452 |
|
| 453 |
// StoreSlicePart stores the 64 elements of x into the slice s. |
| 454 |
// It stores as many elements as will fit in s. |
| 455 |
// If s has 64 or more elements, the method is equivalent to x.StoreSlice. |
| 456 |
func (x Uint8x64) StoreSlicePart(s []uint8) { |
| 457 |
l := len(s) |
| 458 |
if l >= 64 { |
| 459 |
x.StoreSlice(s) |
| 460 |
return |
| 461 |
} |
| 462 |
if l == 0 { |
| 463 |
return |
| 464 |
} |
| 465 |
mask := Mask8x64FromBits(0xffffffffffffffff >> (64 - l)) |
| 466 |
x.StoreMasked(paUint8x64(s), mask) |
| 467 |
} |
| 468 |
|
| 469 |
// LoadUint16x32SlicePart loads a Uint16x32 from the slice s. |
| 470 |
// If s has fewer than 32 elements, the remaining elements of the vector are filled with zeroes. |
| 471 |
// If s has 32 or more elements, the function is equivalent to LoadUint16x32Slice. |
| 472 |
func LoadUint16x32SlicePart(s []uint16) Uint16x32 { |
| 473 |
l := len(s) |
| 474 |
if l >= 32 { |
| 475 |
return LoadUint16x32Slice(s) |
| 476 |
} |
| 477 |
if l == 0 { |
| 478 |
var x Uint16x32 |
| 479 |
return x |
| 480 |
} |
| 481 |
mask := Mask16x32FromBits(0xffffffff >> (32 - l)) |
| 482 |
return LoadMaskedUint16x32(paUint16x32(s), mask) |
| 483 |
} |
| 484 |
|
| 485 |
// StoreSlicePart stores the 32 elements of x into the slice s. |
| 486 |
// It stores as many elements as will fit in s. |
| 487 |
// If s has 32 or more elements, the method is equivalent to x.StoreSlice. |
| 488 |
func (x Uint16x32) StoreSlicePart(s []uint16) { |
| 489 |
l := len(s) |
| 490 |
if l >= 32 { |
| 491 |
x.StoreSlice(s) |
| 492 |
return |
| 493 |
} |
| 494 |
if l == 0 { |
| 495 |
return |
| 496 |
} |
| 497 |
mask := Mask16x32FromBits(0xffffffff >> (32 - l)) |
| 498 |
x.StoreMasked(paUint16x32(s), mask) |
| 499 |
} |
| 500 |
|
| 501 |
// LoadUint32x16SlicePart loads a Uint32x16 from the slice s. |
| 502 |
// If s has fewer than 16 elements, the remaining elements of the vector are filled with zeroes. |
| 503 |
// If s has 16 or more elements, the function is equivalent to LoadUint32x16Slice. |
| 504 |
func LoadUint32x16SlicePart(s []uint32) Uint32x16 { |
| 505 |
l := len(s) |
| 506 |
if l >= 16 { |
| 507 |
return LoadUint32x16Slice(s) |
| 508 |
} |
| 509 |
if l == 0 { |
| 510 |
var x Uint32x16 |
| 511 |
return x |
| 512 |
} |
| 513 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 514 |
return LoadMaskedUint32x16(paUint32x16(s), mask) |
| 515 |
} |
| 516 |
|
| 517 |
// StoreSlicePart stores the 16 elements of x into the slice s. |
| 518 |
// It stores as many elements as will fit in s. |
| 519 |
// If s has 16 or more elements, the method is equivalent to x.StoreSlice. |
| 520 |
func (x Uint32x16) StoreSlicePart(s []uint32) { |
| 521 |
l := len(s) |
| 522 |
if l >= 16 { |
| 523 |
x.StoreSlice(s) |
| 524 |
return |
| 525 |
} |
| 526 |
if l == 0 { |
| 527 |
return |
| 528 |
} |
| 529 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 530 |
x.StoreMasked(paUint32x16(s), mask) |
| 531 |
} |
| 532 |
|
| 533 |
// LoadUint64x8SlicePart loads a Uint64x8 from the slice s. |
| 534 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 535 |
// If s has 8 or more elements, the function is equivalent to LoadUint64x8Slice. |
| 536 |
func LoadUint64x8SlicePart(s []uint64) Uint64x8 { |
| 537 |
l := len(s) |
| 538 |
if l >= 8 { |
| 539 |
return LoadUint64x8Slice(s) |
| 540 |
} |
| 541 |
if l == 0 { |
| 542 |
var x Uint64x8 |
| 543 |
return x |
| 544 |
} |
| 545 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 546 |
return LoadMaskedUint64x8(paUint64x8(s), mask) |
| 547 |
} |
| 548 |
|
| 549 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 550 |
// It stores as many elements as will fit in s. |
| 551 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 552 |
func (x Uint64x8) StoreSlicePart(s []uint64) { |
| 553 |
l := len(s) |
| 554 |
if l >= 8 { |
| 555 |
x.StoreSlice(s) |
| 556 |
return |
| 557 |
} |
| 558 |
if l == 0 { |
| 559 |
return |
| 560 |
} |
| 561 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 562 |
x.StoreMasked(paUint64x8(s), mask) |
| 563 |
} |
| 564 |
|
| 565 |
// LoadFloat32x16SlicePart loads a Float32x16 from the slice s. |
| 566 |
// If s has fewer than 16 elements, the remaining elements of the vector are filled with zeroes. |
| 567 |
// If s has 16 or more elements, the function is equivalent to LoadFloat32x16Slice. |
| 568 |
func LoadFloat32x16SlicePart(s []float32) Float32x16 { |
| 569 |
l := len(s) |
| 570 |
if l >= 16 { |
| 571 |
return LoadFloat32x16Slice(s) |
| 572 |
} |
| 573 |
if l == 0 { |
| 574 |
var x Float32x16 |
| 575 |
return x |
| 576 |
} |
| 577 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 578 |
return LoadMaskedFloat32x16(paFloat32x16(s), mask) |
| 579 |
} |
| 580 |
|
| 581 |
// StoreSlicePart stores the 16 elements of x into the slice s. |
| 582 |
// It stores as many elements as will fit in s. |
| 583 |
// If s has 16 or more elements, the method is equivalent to x.StoreSlice. |
| 584 |
func (x Float32x16) StoreSlicePart(s []float32) { |
| 585 |
l := len(s) |
| 586 |
if l >= 16 { |
| 587 |
x.StoreSlice(s) |
| 588 |
return |
| 589 |
} |
| 590 |
if l == 0 { |
| 591 |
return |
| 592 |
} |
| 593 |
mask := Mask32x16FromBits(0xffff >> (16 - l)) |
| 594 |
x.StoreMasked(paFloat32x16(s), mask) |
| 595 |
} |
| 596 |
|
| 597 |
// LoadFloat64x8SlicePart loads a Float64x8 from the slice s. |
| 598 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 599 |
// If s has 8 or more elements, the function is equivalent to LoadFloat64x8Slice. |
| 600 |
func LoadFloat64x8SlicePart(s []float64) Float64x8 { |
| 601 |
l := len(s) |
| 602 |
if l >= 8 { |
| 603 |
return LoadFloat64x8Slice(s) |
| 604 |
} |
| 605 |
if l == 0 { |
| 606 |
var x Float64x8 |
| 607 |
return x |
| 608 |
} |
| 609 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 610 |
return LoadMaskedFloat64x8(paFloat64x8(s), mask) |
| 611 |
} |
| 612 |
|
| 613 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 614 |
// It stores as many elements as will fit in s. |
| 615 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 616 |
func (x Float64x8) StoreSlicePart(s []float64) { |
| 617 |
l := len(s) |
| 618 |
if l >= 8 { |
| 619 |
x.StoreSlice(s) |
| 620 |
return |
| 621 |
} |
| 622 |
if l == 0 { |
| 623 |
return |
| 624 |
} |
| 625 |
mask := Mask64x8FromBits(0xff >> (8 - l)) |
| 626 |
x.StoreMasked(paFloat64x8(s), mask) |
| 627 |
} |
| 628 |
|
| 629 |
// LoadInt32x4SlicePart loads a Int32x4 from the slice s. |
| 630 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 631 |
// If s has 4 or more elements, the function is equivalent to LoadInt32x4Slice. |
| 632 |
func LoadInt32x4SlicePart(s []int32) Int32x4 { |
| 633 |
l := len(s) |
| 634 |
if l >= 4 { |
| 635 |
return LoadInt32x4Slice(s) |
| 636 |
} |
| 637 |
if l == 0 { |
| 638 |
var x Int32x4 |
| 639 |
return x |
| 640 |
} |
| 641 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 642 |
return LoadMaskedInt32x4(paInt32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 643 |
} |
| 644 |
|
| 645 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 646 |
// It stores as many elements as will fit in s. |
| 647 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 648 |
func (x Int32x4) StoreSlicePart(s []int32) { |
| 649 |
l := len(s) |
| 650 |
if l >= 4 { |
| 651 |
x.StoreSlice(s) |
| 652 |
return |
| 653 |
} |
| 654 |
if l == 0 { |
| 655 |
return |
| 656 |
} |
| 657 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 658 |
x.StoreMasked(paInt32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 659 |
} |
| 660 |
|
| 661 |
// LoadInt64x2SlicePart loads a Int64x2 from the slice s. |
| 662 |
// If s has fewer than 2 elements, the remaining elements of the vector are filled with zeroes. |
| 663 |
// If s has 2 or more elements, the function is equivalent to LoadInt64x2Slice. |
| 664 |
func LoadInt64x2SlicePart(s []int64) Int64x2 { |
| 665 |
l := len(s) |
| 666 |
if l >= 2 { |
| 667 |
return LoadInt64x2Slice(s) |
| 668 |
} |
| 669 |
if l == 0 { |
| 670 |
var x Int64x2 |
| 671 |
return x |
| 672 |
} |
| 673 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 674 |
return LoadMaskedInt64x2(paInt64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 675 |
} |
| 676 |
|
| 677 |
// StoreSlicePart stores the 2 elements of x into the slice s. |
| 678 |
// It stores as many elements as will fit in s. |
| 679 |
// If s has 2 or more elements, the method is equivalent to x.StoreSlice. |
| 680 |
func (x Int64x2) StoreSlicePart(s []int64) { |
| 681 |
l := len(s) |
| 682 |
if l >= 2 { |
| 683 |
x.StoreSlice(s) |
| 684 |
return |
| 685 |
} |
| 686 |
if l == 0 { |
| 687 |
return |
| 688 |
} |
| 689 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 690 |
x.StoreMasked(paInt64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 691 |
} |
| 692 |
|
| 693 |
// LoadUint32x4SlicePart loads a Uint32x4 from the slice s. |
| 694 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 695 |
// If s has 4 or more elements, the function is equivalent to LoadUint32x4Slice. |
| 696 |
func LoadUint32x4SlicePart(s []uint32) Uint32x4 { |
| 697 |
l := len(s) |
| 698 |
if l >= 4 { |
| 699 |
return LoadUint32x4Slice(s) |
| 700 |
} |
| 701 |
if l == 0 { |
| 702 |
var x Uint32x4 |
| 703 |
return x |
| 704 |
} |
| 705 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 706 |
return LoadMaskedUint32x4(paUint32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 707 |
} |
| 708 |
|
| 709 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 710 |
// It stores as many elements as will fit in s. |
| 711 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 712 |
func (x Uint32x4) StoreSlicePart(s []uint32) { |
| 713 |
l := len(s) |
| 714 |
if l >= 4 { |
| 715 |
x.StoreSlice(s) |
| 716 |
return |
| 717 |
} |
| 718 |
if l == 0 { |
| 719 |
return |
| 720 |
} |
| 721 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 722 |
x.StoreMasked(paUint32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 723 |
} |
| 724 |
|
| 725 |
// LoadUint64x2SlicePart loads a Uint64x2 from the slice s. |
| 726 |
// If s has fewer than 2 elements, the remaining elements of the vector are filled with zeroes. |
| 727 |
// If s has 2 or more elements, the function is equivalent to LoadUint64x2Slice. |
| 728 |
func LoadUint64x2SlicePart(s []uint64) Uint64x2 { |
| 729 |
l := len(s) |
| 730 |
if l >= 2 { |
| 731 |
return LoadUint64x2Slice(s) |
| 732 |
} |
| 733 |
if l == 0 { |
| 734 |
var x Uint64x2 |
| 735 |
return x |
| 736 |
} |
| 737 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 738 |
return LoadMaskedUint64x2(paUint64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 739 |
} |
| 740 |
|
| 741 |
// StoreSlicePart stores the 2 elements of x into the slice s. |
| 742 |
// It stores as many elements as will fit in s. |
| 743 |
// If s has 2 or more elements, the method is equivalent to x.StoreSlice. |
| 744 |
func (x Uint64x2) StoreSlicePart(s []uint64) { |
| 745 |
l := len(s) |
| 746 |
if l >= 2 { |
| 747 |
x.StoreSlice(s) |
| 748 |
return |
| 749 |
} |
| 750 |
if l == 0 { |
| 751 |
return |
| 752 |
} |
| 753 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 754 |
x.StoreMasked(paUint64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 755 |
} |
| 756 |
|
| 757 |
// LoadFloat32x4SlicePart loads a Float32x4 from the slice s. |
| 758 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 759 |
// If s has 4 or more elements, the function is equivalent to LoadFloat32x4Slice. |
| 760 |
func LoadFloat32x4SlicePart(s []float32) Float32x4 { |
| 761 |
l := len(s) |
| 762 |
if l >= 4 { |
| 763 |
return LoadFloat32x4Slice(s) |
| 764 |
} |
| 765 |
if l == 0 { |
| 766 |
var x Float32x4 |
| 767 |
return x |
| 768 |
} |
| 769 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 770 |
return LoadMaskedFloat32x4(paFloat32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 771 |
} |
| 772 |
|
| 773 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 774 |
// It stores as many elements as will fit in s. |
| 775 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 776 |
func (x Float32x4) StoreSlicePart(s []float32) { |
| 777 |
l := len(s) |
| 778 |
if l >= 4 { |
| 779 |
x.StoreSlice(s) |
| 780 |
return |
| 781 |
} |
| 782 |
if l == 0 { |
| 783 |
return |
| 784 |
} |
| 785 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 786 |
x.StoreMasked(paFloat32x4(s), LoadInt32x4Slice(mask).asMask()) |
| 787 |
} |
| 788 |
|
| 789 |
// LoadFloat64x2SlicePart loads a Float64x2 from the slice s. |
| 790 |
// If s has fewer than 2 elements, the remaining elements of the vector are filled with zeroes. |
| 791 |
// If s has 2 or more elements, the function is equivalent to LoadFloat64x2Slice. |
| 792 |
func LoadFloat64x2SlicePart(s []float64) Float64x2 { |
| 793 |
l := len(s) |
| 794 |
if l >= 2 { |
| 795 |
return LoadFloat64x2Slice(s) |
| 796 |
} |
| 797 |
if l == 0 { |
| 798 |
var x Float64x2 |
| 799 |
return x |
| 800 |
} |
| 801 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 802 |
return LoadMaskedFloat64x2(paFloat64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 803 |
} |
| 804 |
|
| 805 |
// StoreSlicePart stores the 2 elements of x into the slice s. |
| 806 |
// It stores as many elements as will fit in s. |
| 807 |
// If s has 2 or more elements, the method is equivalent to x.StoreSlice. |
| 808 |
func (x Float64x2) StoreSlicePart(s []float64) { |
| 809 |
l := len(s) |
| 810 |
if l >= 2 { |
| 811 |
x.StoreSlice(s) |
| 812 |
return |
| 813 |
} |
| 814 |
if l == 0 { |
| 815 |
return |
| 816 |
} |
| 817 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 818 |
x.StoreMasked(paFloat64x2(s), LoadInt64x2Slice(mask).asMask()) |
| 819 |
} |
| 820 |
|
| 821 |
// LoadInt32x8SlicePart loads a Int32x8 from the slice s. |
| 822 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 823 |
// If s has 8 or more elements, the function is equivalent to LoadInt32x8Slice. |
| 824 |
func LoadInt32x8SlicePart(s []int32) Int32x8 { |
| 825 |
l := len(s) |
| 826 |
if l >= 8 { |
| 827 |
return LoadInt32x8Slice(s) |
| 828 |
} |
| 829 |
if l == 0 { |
| 830 |
var x Int32x8 |
| 831 |
return x |
| 832 |
} |
| 833 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 834 |
return LoadMaskedInt32x8(paInt32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 835 |
} |
| 836 |
|
| 837 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 838 |
// It stores as many elements as will fit in s. |
| 839 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 840 |
func (x Int32x8) StoreSlicePart(s []int32) { |
| 841 |
l := len(s) |
| 842 |
if l >= 8 { |
| 843 |
x.StoreSlice(s) |
| 844 |
return |
| 845 |
} |
| 846 |
if l == 0 { |
| 847 |
return |
| 848 |
} |
| 849 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 850 |
x.StoreMasked(paInt32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 851 |
} |
| 852 |
|
| 853 |
// LoadInt64x4SlicePart loads a Int64x4 from the slice s. |
| 854 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 855 |
// If s has 4 or more elements, the function is equivalent to LoadInt64x4Slice. |
| 856 |
func LoadInt64x4SlicePart(s []int64) Int64x4 { |
| 857 |
l := len(s) |
| 858 |
if l >= 4 { |
| 859 |
return LoadInt64x4Slice(s) |
| 860 |
} |
| 861 |
if l == 0 { |
| 862 |
var x Int64x4 |
| 863 |
return x |
| 864 |
} |
| 865 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 866 |
return LoadMaskedInt64x4(paInt64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 867 |
} |
| 868 |
|
| 869 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 870 |
// It stores as many elements as will fit in s. |
| 871 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 872 |
func (x Int64x4) StoreSlicePart(s []int64) { |
| 873 |
l := len(s) |
| 874 |
if l >= 4 { |
| 875 |
x.StoreSlice(s) |
| 876 |
return |
| 877 |
} |
| 878 |
if l == 0 { |
| 879 |
return |
| 880 |
} |
| 881 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 882 |
x.StoreMasked(paInt64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 883 |
} |
| 884 |
|
| 885 |
// LoadUint32x8SlicePart loads a Uint32x8 from the slice s. |
| 886 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 887 |
// If s has 8 or more elements, the function is equivalent to LoadUint32x8Slice. |
| 888 |
func LoadUint32x8SlicePart(s []uint32) Uint32x8 { |
| 889 |
l := len(s) |
| 890 |
if l >= 8 { |
| 891 |
return LoadUint32x8Slice(s) |
| 892 |
} |
| 893 |
if l == 0 { |
| 894 |
var x Uint32x8 |
| 895 |
return x |
| 896 |
} |
| 897 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 898 |
return LoadMaskedUint32x8(paUint32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 899 |
} |
| 900 |
|
| 901 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 902 |
// It stores as many elements as will fit in s. |
| 903 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 904 |
func (x Uint32x8) StoreSlicePart(s []uint32) { |
| 905 |
l := len(s) |
| 906 |
if l >= 8 { |
| 907 |
x.StoreSlice(s) |
| 908 |
return |
| 909 |
} |
| 910 |
if l == 0 { |
| 911 |
return |
| 912 |
} |
| 913 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 914 |
x.StoreMasked(paUint32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 915 |
} |
| 916 |
|
| 917 |
// LoadUint64x4SlicePart loads a Uint64x4 from the slice s. |
| 918 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 919 |
// If s has 4 or more elements, the function is equivalent to LoadUint64x4Slice. |
| 920 |
func LoadUint64x4SlicePart(s []uint64) Uint64x4 { |
| 921 |
l := len(s) |
| 922 |
if l >= 4 { |
| 923 |
return LoadUint64x4Slice(s) |
| 924 |
} |
| 925 |
if l == 0 { |
| 926 |
var x Uint64x4 |
| 927 |
return x |
| 928 |
} |
| 929 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 930 |
return LoadMaskedUint64x4(paUint64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 931 |
} |
| 932 |
|
| 933 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 934 |
// It stores as many elements as will fit in s. |
| 935 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 936 |
func (x Uint64x4) StoreSlicePart(s []uint64) { |
| 937 |
l := len(s) |
| 938 |
if l >= 4 { |
| 939 |
x.StoreSlice(s) |
| 940 |
return |
| 941 |
} |
| 942 |
if l == 0 { |
| 943 |
return |
| 944 |
} |
| 945 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 946 |
x.StoreMasked(paUint64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 947 |
} |
| 948 |
|
| 949 |
// LoadFloat32x8SlicePart loads a Float32x8 from the slice s. |
| 950 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 951 |
// If s has 8 or more elements, the function is equivalent to LoadFloat32x8Slice. |
| 952 |
func LoadFloat32x8SlicePart(s []float32) Float32x8 { |
| 953 |
l := len(s) |
| 954 |
if l >= 8 { |
| 955 |
return LoadFloat32x8Slice(s) |
| 956 |
} |
| 957 |
if l == 0 { |
| 958 |
var x Float32x8 |
| 959 |
return x |
| 960 |
} |
| 961 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 962 |
return LoadMaskedFloat32x8(paFloat32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 963 |
} |
| 964 |
|
| 965 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 966 |
// It stores as many elements as will fit in s. |
| 967 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 968 |
func (x Float32x8) StoreSlicePart(s []float32) { |
| 969 |
l := len(s) |
| 970 |
if l >= 8 { |
| 971 |
x.StoreSlice(s) |
| 972 |
return |
| 973 |
} |
| 974 |
if l == 0 { |
| 975 |
return |
| 976 |
} |
| 977 |
mask := vecMask32[len(vecMask32)/2-l:] |
| 978 |
x.StoreMasked(paFloat32x8(s), LoadInt32x8Slice(mask).asMask()) |
| 979 |
} |
| 980 |
|
| 981 |
// LoadFloat64x4SlicePart loads a Float64x4 from the slice s. |
| 982 |
// If s has fewer than 4 elements, the remaining elements of the vector are filled with zeroes. |
| 983 |
// If s has 4 or more elements, the function is equivalent to LoadFloat64x4Slice. |
| 984 |
func LoadFloat64x4SlicePart(s []float64) Float64x4 { |
| 985 |
l := len(s) |
| 986 |
if l >= 4 { |
| 987 |
return LoadFloat64x4Slice(s) |
| 988 |
} |
| 989 |
if l == 0 { |
| 990 |
var x Float64x4 |
| 991 |
return x |
| 992 |
} |
| 993 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 994 |
return LoadMaskedFloat64x4(paFloat64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 995 |
} |
| 996 |
|
| 997 |
// StoreSlicePart stores the 4 elements of x into the slice s. |
| 998 |
// It stores as many elements as will fit in s. |
| 999 |
// If s has 4 or more elements, the method is equivalent to x.StoreSlice. |
| 1000 |
func (x Float64x4) StoreSlicePart(s []float64) { |
| 1001 |
l := len(s) |
| 1002 |
if l >= 4 { |
| 1003 |
x.StoreSlice(s) |
| 1004 |
return |
| 1005 |
} |
| 1006 |
if l == 0 { |
| 1007 |
return |
| 1008 |
} |
| 1009 |
mask := vecMask64[len(vecMask64)/2-l:] |
| 1010 |
x.StoreMasked(paFloat64x4(s), LoadInt64x4Slice(mask).asMask()) |
| 1011 |
} |
| 1012 |
|
| 1013 |
// LoadUint8x16SlicePart loads a Uint8x16 from the slice s. |
| 1014 |
// If s has fewer than 16 elements, the remaining elements of the vector are filled with zeroes. |
| 1015 |
// If s has 16 or more elements, the function is equivalent to LoadUint8x16Slice. |
| 1016 |
func LoadUint8x16SlicePart(s []uint8) Uint8x16 { |
| 1017 |
if len(s) == 0 { |
| 1018 |
var zero Uint8x16 |
| 1019 |
return zero |
| 1020 |
} |
| 1021 |
t := unsafe.Slice((*int8)(unsafe.Pointer(&s[0])), len(s)) |
| 1022 |
return LoadInt8x16SlicePart(t).AsUint8x16() |
| 1023 |
} |
| 1024 |
|
| 1025 |
// StoreSlicePart stores the 16 elements of x into the slice s. |
| 1026 |
// It stores as many elements as will fit in s. |
| 1027 |
// If s has 16 or more elements, the method is equivalent to x.StoreSlice. |
| 1028 |
func (x Uint8x16) StoreSlicePart(s []uint8) { |
| 1029 |
if len(s) == 0 { |
| 1030 |
return |
| 1031 |
} |
| 1032 |
t := unsafe.Slice((*int8)(unsafe.Pointer(&s[0])), len(s)) |
| 1033 |
x.AsInt8x16().StoreSlicePart(t) |
| 1034 |
} |
| 1035 |
|
| 1036 |
// LoadUint16x8SlicePart loads a Uint16x8 from the slice s. |
| 1037 |
// If s has fewer than 8 elements, the remaining elements of the vector are filled with zeroes. |
| 1038 |
// If s has 8 or more elements, the function is equivalent to LoadUint16x8Slice. |
| 1039 |
func LoadUint16x8SlicePart(s []uint16) Uint16x8 { |
| 1040 |
if len(s) == 0 { |
| 1041 |
var zero Uint16x8 |
| 1042 |
return zero |
| 1043 |
} |
| 1044 |
t := unsafe.Slice((*int16)(unsafe.Pointer(&s[0])), len(s)) |
| 1045 |
return LoadInt16x8SlicePart(t).AsUint16x8() |
| 1046 |
} |
| 1047 |
|
| 1048 |
// StoreSlicePart stores the 8 elements of x into the slice s. |
| 1049 |
// It stores as many elements as will fit in s. |
| 1050 |
// If s has 8 or more elements, the method is equivalent to x.StoreSlice. |
| 1051 |
func (x Uint16x8) StoreSlicePart(s []uint16) { |
| 1052 |
if len(s) == 0 { |
| 1053 |
return |
| 1054 |
} |
| 1055 |
t := unsafe.Slice((*int16)(unsafe.Pointer(&s[0])), len(s)) |
| 1056 |
x.AsInt16x8().StoreSlicePart(t) |
| 1057 |
} |
| 1058 |
|
| 1059 |
// LoadUint8x32SlicePart loads a Uint8x32 from the slice s. |
| 1060 |
// If s has fewer than 32 elements, the remaining elements of the vector are filled with zeroes. |
| 1061 |
// If s has 32 or more elements, the function is equivalent to LoadUint8x32Slice. |
| 1062 |
func LoadUint8x32SlicePart(s []uint8) Uint8x32 { |
| 1063 |
if len(s) == 0 { |
| 1064 |
var zero Uint8x32 |
| 1065 |
return zero |
| 1066 |
} |
| 1067 |
t := unsafe.Slice((*int8)(unsafe.Pointer(&s[0])), len(s)) |
| 1068 |
return LoadInt8x32SlicePart(t).AsUint8x32() |
| 1069 |
} |
| 1070 |
|
| 1071 |
// StoreSlicePart stores the 32 elements of x into the slice s. |
| 1072 |
// It stores as many elements as will fit in s. |
| 1073 |
// If s has 32 or more elements, the method is equivalent to x.StoreSlice. |
| 1074 |
func (x Uint8x32) StoreSlicePart(s []uint8) { |
| 1075 |
if len(s) == 0 { |
| 1076 |
return |
| 1077 |
} |
| 1078 |
t := unsafe.Slice((*int8)(unsafe.Pointer(&s[0])), len(s)) |
| 1079 |
x.AsInt8x32().StoreSlicePart(t) |
| 1080 |
} |
| 1081 |
|
| 1082 |
// LoadUint16x16SlicePart loads a Uint16x16 from the slice s. |
| 1083 |
// If s has fewer than 16 elements, the remaining elements of the vector are filled with zeroes. |
| 1084 |
// If s has 16 or more elements, the function is equivalent to LoadUint16x16Slice. |
| 1085 |
func LoadUint16x16SlicePart(s []uint16) Uint16x16 { |
| 1086 |
if len(s) == 0 { |
| 1087 |
var zero Uint16x16 |
| 1088 |
return zero |
| 1089 |
} |
| 1090 |
t := unsafe.Slice((*int16)(unsafe.Pointer(&s[0])), len(s)) |
| 1091 |
return LoadInt16x16SlicePart(t).AsUint16x16() |
| 1092 |
} |
| 1093 |
|
| 1094 |
// StoreSlicePart stores the 16 elements of x into the slice s. |
| 1095 |
// It stores as many elements as will fit in s. |
| 1096 |
// If s has 16 or more elements, the method is equivalent to x.StoreSlice. |
| 1097 |
func (x Uint16x16) StoreSlicePart(s []uint16) { |
| 1098 |
if len(s) == 0 { |
| 1099 |
return |
| 1100 |
} |
| 1101 |
t := unsafe.Slice((*int16)(unsafe.Pointer(&s[0])), len(s)) |
| 1102 |
x.AsInt16x16().StoreSlicePart(t) |
| 1103 |
} |