Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Vector.cs
Go to the documentation of this file.
5using System.Text;
7
8namespace System.Numerics;
9
10[Intrinsic]
11public static class Vector
12{
13 public static bool IsHardwareAccelerated
14 {
15 [Intrinsic]
16 get
17 {
18 return false;
19 }
20 }
21
22 [MethodImpl(MethodImplOptions.AggressiveInlining)]
23 [Intrinsic]
25 {
26 return Vector<float>.ConditionalSelect((Vector<float>)condition, left, right);
27 }
28
29 [MethodImpl(MethodImplOptions.AggressiveInlining)]
30 [Intrinsic]
32 {
33 return Vector<double>.ConditionalSelect((Vector<double>)condition, left, right);
34 }
35
36 [MethodImpl(MethodImplOptions.AggressiveInlining)]
37 [Intrinsic]
38 public static Vector<T> ConditionalSelect<T>(Vector<T> condition, Vector<T> left, Vector<T> right) where T : struct
39 {
40 return Vector<T>.ConditionalSelect(condition, left, right);
41 }
42
43 [MethodImpl(MethodImplOptions.AggressiveInlining)]
44 [Intrinsic]
45 public static Vector<T> Equals<T>(Vector<T> left, Vector<T> right) where T : struct
46 {
47 return Vector<T>.Equals(left, right);
48 }
49
50 [MethodImpl(MethodImplOptions.AggressiveInlining)]
51 [Intrinsic]
52 public static Vector<int> Equals(Vector<float> left, Vector<float> right)
53 {
54 return (Vector<int>)Vector<float>.Equals(left, right);
55 }
56
57 [MethodImpl(MethodImplOptions.AggressiveInlining)]
58 [Intrinsic]
59 public static Vector<int> Equals(Vector<int> left, Vector<int> right)
60 {
61 return Vector<int>.Equals(left, right);
62 }
63
64 [MethodImpl(MethodImplOptions.AggressiveInlining)]
65 [Intrinsic]
67 {
68 return (Vector<long>)Vector<double>.Equals(left, right);
69 }
70
71 [MethodImpl(MethodImplOptions.AggressiveInlining)]
72 [Intrinsic]
73 public static Vector<long> Equals(Vector<long> left, Vector<long> right)
74 {
75 return Vector<long>.Equals(left, right);
76 }
77
78 [MethodImpl(MethodImplOptions.AggressiveInlining)]
79 public static bool EqualsAll<T>(Vector<T> left, Vector<T> right) where T : struct
80 {
81 return left == right;
82 }
83
84 [MethodImpl(MethodImplOptions.AggressiveInlining)]
85 public static bool EqualsAny<T>(Vector<T> left, Vector<T> right) where T : struct
86 {
87 return !Vector<T>.Equals(left, right).Equals(Vector<T>.Zero);
88 }
89
90 [MethodImpl(MethodImplOptions.AggressiveInlining)]
91 [Intrinsic]
92 public static Vector<T> LessThan<T>(Vector<T> left, Vector<T> right) where T : struct
93 {
94 return Vector<T>.LessThan(left, right);
95 }
96
97 [MethodImpl(MethodImplOptions.AggressiveInlining)]
98 [Intrinsic]
100 {
101 return (Vector<int>)Vector<float>.LessThan(left, right);
102 }
103
104 [MethodImpl(MethodImplOptions.AggressiveInlining)]
105 [Intrinsic]
106 public static Vector<int> LessThan(Vector<int> left, Vector<int> right)
107 {
108 return Vector<int>.LessThan(left, right);
109 }
110
111 [MethodImpl(MethodImplOptions.AggressiveInlining)]
112 [Intrinsic]
114 {
115 return (Vector<long>)Vector<double>.LessThan(left, right);
116 }
117
118 [MethodImpl(MethodImplOptions.AggressiveInlining)]
119 [Intrinsic]
121 {
122 return Vector<long>.LessThan(left, right);
123 }
124
125 [MethodImpl(MethodImplOptions.AggressiveInlining)]
126 public static bool LessThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
127 {
128 return ((Vector<int>)Vector<T>.LessThan(left, right)).Equals(Vector<int>.AllBitsSet);
129 }
130
131 [MethodImpl(MethodImplOptions.AggressiveInlining)]
132 public static bool LessThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
133 {
134 return !((Vector<int>)Vector<T>.LessThan(left, right)).Equals(Vector<int>.Zero);
135 }
136
137 [MethodImpl(MethodImplOptions.AggressiveInlining)]
138 [Intrinsic]
139 public static Vector<T> LessThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
140 {
141 return Vector<T>.LessThanOrEqual(left, right);
142 }
143
144 [MethodImpl(MethodImplOptions.AggressiveInlining)]
145 [Intrinsic]
147 {
148 return (Vector<int>)Vector<float>.LessThanOrEqual(left, right);
149 }
150
151 [MethodImpl(MethodImplOptions.AggressiveInlining)]
152 [Intrinsic]
154 {
155 return Vector<int>.LessThanOrEqual(left, right);
156 }
157
158 [MethodImpl(MethodImplOptions.AggressiveInlining)]
159 [Intrinsic]
161 {
162 return Vector<long>.LessThanOrEqual(left, right);
163 }
164
165 [MethodImpl(MethodImplOptions.AggressiveInlining)]
166 [Intrinsic]
168 {
169 return (Vector<long>)Vector<double>.LessThanOrEqual(left, right);
170 }
171
172 [MethodImpl(MethodImplOptions.AggressiveInlining)]
173 public static bool LessThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
174 {
175 return ((Vector<int>)Vector<T>.LessThanOrEqual(left, right)).Equals(Vector<int>.AllBitsSet);
176 }
177
178 [MethodImpl(MethodImplOptions.AggressiveInlining)]
179 public static bool LessThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
180 {
182 }
183
184 [MethodImpl(MethodImplOptions.AggressiveInlining)]
185 [Intrinsic]
186 public static Vector<T> GreaterThan<T>(Vector<T> left, Vector<T> right) where T : struct
187 {
188 return Vector<T>.GreaterThan(left, right);
189 }
190
191 [MethodImpl(MethodImplOptions.AggressiveInlining)]
192 [Intrinsic]
194 {
195 return (Vector<int>)Vector<float>.GreaterThan(left, right);
196 }
197
198 [MethodImpl(MethodImplOptions.AggressiveInlining)]
199 [Intrinsic]
201 {
202 return Vector<int>.GreaterThan(left, right);
203 }
204
205 [MethodImpl(MethodImplOptions.AggressiveInlining)]
206 [Intrinsic]
208 {
209 return (Vector<long>)Vector<double>.GreaterThan(left, right);
210 }
211
212 [MethodImpl(MethodImplOptions.AggressiveInlining)]
213 [Intrinsic]
215 {
216 return Vector<long>.GreaterThan(left, right);
217 }
218
219 [MethodImpl(MethodImplOptions.AggressiveInlining)]
220 public static bool GreaterThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
221 {
222 return ((Vector<int>)Vector<T>.GreaterThan(left, right)).Equals(Vector<int>.AllBitsSet);
223 }
224
225 [MethodImpl(MethodImplOptions.AggressiveInlining)]
226 public static bool GreaterThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
227 {
228 return !((Vector<int>)Vector<T>.GreaterThan(left, right)).Equals(Vector<int>.Zero);
229 }
230
231 [MethodImpl(MethodImplOptions.AggressiveInlining)]
232 [Intrinsic]
233 public static Vector<T> GreaterThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
234 {
235 return Vector<T>.GreaterThanOrEqual(left, right);
236 }
237
238 [MethodImpl(MethodImplOptions.AggressiveInlining)]
239 [Intrinsic]
241 {
242 return (Vector<int>)Vector<float>.GreaterThanOrEqual(left, right);
243 }
244
245 [MethodImpl(MethodImplOptions.AggressiveInlining)]
246 [Intrinsic]
248 {
249 return Vector<int>.GreaterThanOrEqual(left, right);
250 }
251
252 [MethodImpl(MethodImplOptions.AggressiveInlining)]
253 [Intrinsic]
255 {
256 return Vector<long>.GreaterThanOrEqual(left, right);
257 }
258
259 [MethodImpl(MethodImplOptions.AggressiveInlining)]
260 [Intrinsic]
262 {
264 }
265
266 [MethodImpl(MethodImplOptions.AggressiveInlining)]
267 public static bool GreaterThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
268 {
269 return ((Vector<int>)Vector<T>.GreaterThanOrEqual(left, right)).Equals(Vector<int>.AllBitsSet);
270 }
271
272 [MethodImpl(MethodImplOptions.AggressiveInlining)]
273 public static bool GreaterThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
274 {
276 }
277
278 [MethodImpl(MethodImplOptions.AggressiveInlining)]
279 [Intrinsic]
280 public static Vector<T> Abs<T>(Vector<T> value) where T : struct
281 {
282 return Vector<T>.Abs(value);
283 }
284
285 [MethodImpl(MethodImplOptions.AggressiveInlining)]
286 [Intrinsic]
287 public static Vector<T> Min<T>(Vector<T> left, Vector<T> right) where T : struct
288 {
289 return Vector<T>.Min(left, right);
290 }
291
292 [MethodImpl(MethodImplOptions.AggressiveInlining)]
293 [Intrinsic]
294 public static Vector<T> Max<T>(Vector<T> left, Vector<T> right) where T : struct
295 {
296 return Vector<T>.Max(left, right);
297 }
298
299 [MethodImpl(MethodImplOptions.AggressiveInlining)]
300 [Intrinsic]
301 public static T Dot<T>(Vector<T> left, Vector<T> right) where T : struct
302 {
303 return Vector<T>.Dot(left, right);
304 }
305
306 [MethodImpl(MethodImplOptions.AggressiveInlining)]
307 [Intrinsic]
308 public static Vector<T> SquareRoot<T>(Vector<T> value) where T : struct
309 {
310 return Vector<T>.SquareRoot(value);
311 }
312
313 [MethodImpl(MethodImplOptions.AggressiveInlining)]
314 [Intrinsic]
316 {
318 }
319
320 [MethodImpl(MethodImplOptions.AggressiveInlining)]
321 [Intrinsic]
323 {
325 }
326
327 [MethodImpl(MethodImplOptions.AggressiveInlining)]
328 [Intrinsic]
330 {
331 return Vector<float>.Floor(value);
332 }
333
334 [MethodImpl(MethodImplOptions.AggressiveInlining)]
335 [Intrinsic]
337 {
338 return Vector<double>.Floor(value);
339 }
340
341 [MethodImpl(MethodImplOptions.AggressiveInlining)]
342 public static Vector<T> Add<T>(Vector<T> left, Vector<T> right) where T : struct
343 {
344 return left + right;
345 }
346
347 [MethodImpl(MethodImplOptions.AggressiveInlining)]
348 public static Vector<T> Subtract<T>(Vector<T> left, Vector<T> right) where T : struct
349 {
350 return left - right;
351 }
352
353 [MethodImpl(MethodImplOptions.AggressiveInlining)]
354 public static Vector<T> Multiply<T>(Vector<T> left, Vector<T> right) where T : struct
355 {
356 return left * right;
357 }
358
359 [MethodImpl(MethodImplOptions.AggressiveInlining)]
360 public static Vector<T> Multiply<T>(Vector<T> left, T right) where T : struct
361 {
362 return left * right;
363 }
364
365 [MethodImpl(MethodImplOptions.AggressiveInlining)]
366 public static Vector<T> Multiply<T>(T left, Vector<T> right) where T : struct
367 {
368 return left * right;
369 }
370
371 [MethodImpl(MethodImplOptions.AggressiveInlining)]
372 public static Vector<T> Divide<T>(Vector<T> left, Vector<T> right) where T : struct
373 {
374 return left / right;
375 }
376
377 [MethodImpl(MethodImplOptions.AggressiveInlining)]
378 public static Vector<T> Negate<T>(Vector<T> value) where T : struct
379 {
380 return -value;
381 }
382
383 [MethodImpl(MethodImplOptions.AggressiveInlining)]
384 public static Vector<T> BitwiseAnd<T>(Vector<T> left, Vector<T> right) where T : struct
385 {
386 return left & right;
387 }
388
389 [MethodImpl(MethodImplOptions.AggressiveInlining)]
390 public static Vector<T> BitwiseOr<T>(Vector<T> left, Vector<T> right) where T : struct
391 {
392 return left | right;
393 }
394
395 [MethodImpl(MethodImplOptions.AggressiveInlining)]
396 public static Vector<T> OnesComplement<T>(Vector<T> value) where T : struct
397 {
398 return ~value;
399 }
400
401 [MethodImpl(MethodImplOptions.AggressiveInlining)]
402 public static Vector<T> Xor<T>(Vector<T> left, Vector<T> right) where T : struct
403 {
404 return left ^ right;
405 }
406
407 [MethodImpl(MethodImplOptions.AggressiveInlining)]
408 [Intrinsic]
409 public static Vector<T> AndNot<T>(Vector<T> left, Vector<T> right) where T : struct
410 {
411 return left & ~right;
412 }
413
414 [MethodImpl(MethodImplOptions.AggressiveInlining)]
415 public static Vector<byte> AsVectorByte<T>(Vector<T> value) where T : struct
416 {
417 return (Vector<byte>)value;
418 }
419
420 [MethodImpl(MethodImplOptions.AggressiveInlining)]
421 [CLSCompliant(false)]
422 public static Vector<sbyte> AsVectorSByte<T>(Vector<T> value) where T : struct
423 {
424 return (Vector<sbyte>)value;
425 }
426
427 [MethodImpl(MethodImplOptions.AggressiveInlining)]
428 [CLSCompliant(false)]
429 public static Vector<ushort> AsVectorUInt16<T>(Vector<T> value) where T : struct
430 {
431 return (Vector<ushort>)value;
432 }
433
434 [MethodImpl(MethodImplOptions.AggressiveInlining)]
435 public static Vector<short> AsVectorInt16<T>(Vector<T> value) where T : struct
436 {
437 return (Vector<short>)value;
438 }
439
440 [MethodImpl(MethodImplOptions.AggressiveInlining)]
441 [CLSCompliant(false)]
442 public static Vector<uint> AsVectorUInt32<T>(Vector<T> value) where T : struct
443 {
444 return (Vector<uint>)value;
445 }
446
447 [MethodImpl(MethodImplOptions.AggressiveInlining)]
448 public static Vector<int> AsVectorInt32<T>(Vector<T> value) where T : struct
449 {
450 return (Vector<int>)value;
451 }
452
453 [MethodImpl(MethodImplOptions.AggressiveInlining)]
454 [CLSCompliant(false)]
455 public static Vector<ulong> AsVectorUInt64<T>(Vector<T> value) where T : struct
456 {
457 return (Vector<ulong>)value;
458 }
459
460 [MethodImpl(MethodImplOptions.AggressiveInlining)]
461 public static Vector<long> AsVectorInt64<T>(Vector<T> value) where T : struct
462 {
463 return (Vector<long>)value;
464 }
465
466 [MethodImpl(MethodImplOptions.AggressiveInlining)]
467 public static Vector<float> AsVectorSingle<T>(Vector<T> value) where T : struct
468 {
469 return (Vector<float>)value;
470 }
471
472 [MethodImpl(MethodImplOptions.AggressiveInlining)]
473 public static Vector<double> AsVectorDouble<T>(Vector<T> value) where T : struct
474 {
475 return (Vector<double>)value;
476 }
477
478 [MethodImpl(MethodImplOptions.AggressiveInlining)]
479 [CLSCompliant(false)]
480 public static Vector<nuint> AsVectorNUInt<T>(Vector<T> value) where T : struct
481 {
482 return (Vector<nuint>)value;
483 }
484
485 [MethodImpl(MethodImplOptions.AggressiveInlining)]
486 public static Vector<nint> AsVectorNInt<T>(Vector<T> value) where T : struct
487 {
488 return (Vector<nint>)value;
489 }
490
491 [CLSCompliant(false)]
492 [Intrinsic]
493 public unsafe static void Widen(Vector<byte> source, out Vector<ushort> low, out Vector<ushort> high)
494 {
496 ushort* ptr = stackalloc ushort[count / 2];
497 for (int i = 0; i < count / 2; i++)
498 {
499 ptr[i] = source[i];
500 }
501 ushort* ptr2 = stackalloc ushort[count / 2];
502 for (int j = 0; j < count / 2; j++)
503 {
504 ptr2[j] = source[j + count / 2];
505 }
506 low = *(Vector<ushort>*)ptr;
507 high = *(Vector<ushort>*)ptr2;
508 }
509
510 [CLSCompliant(false)]
511 [Intrinsic]
512 public unsafe static void Widen(Vector<ushort> source, out Vector<uint> low, out Vector<uint> high)
513 {
515 uint* ptr = stackalloc uint[count / 2];
516 for (int i = 0; i < count / 2; i++)
517 {
518 ptr[i] = source[i];
519 }
520 uint* ptr2 = stackalloc uint[count / 2];
521 for (int j = 0; j < count / 2; j++)
522 {
523 ptr2[j] = source[j + count / 2];
524 }
525 low = *(Vector<uint>*)ptr;
526 high = *(Vector<uint>*)ptr2;
527 }
528
529 [CLSCompliant(false)]
530 [Intrinsic]
531 public unsafe static void Widen(Vector<uint> source, out Vector<ulong> low, out Vector<ulong> high)
532 {
534 ulong* ptr = stackalloc ulong[count / 2];
535 for (int i = 0; i < count / 2; i++)
536 {
537 ptr[i] = source[i];
538 }
539 ulong* ptr2 = stackalloc ulong[count / 2];
540 for (int j = 0; j < count / 2; j++)
541 {
542 ptr2[j] = source[j + count / 2];
543 }
544 low = *(Vector<ulong>*)ptr;
545 high = *(Vector<ulong>*)ptr2;
546 }
547
548 [CLSCompliant(false)]
549 [Intrinsic]
550 public unsafe static void Widen(Vector<sbyte> source, out Vector<short> low, out Vector<short> high)
551 {
553 short* ptr = stackalloc short[count / 2];
554 for (int i = 0; i < count / 2; i++)
555 {
556 ptr[i] = source[i];
557 }
558 short* ptr2 = stackalloc short[count / 2];
559 for (int j = 0; j < count / 2; j++)
560 {
561 ptr2[j] = source[j + count / 2];
562 }
563 low = *(Vector<short>*)ptr;
564 high = *(Vector<short>*)ptr2;
565 }
566
567 [Intrinsic]
568 public unsafe static void Widen(Vector<short> source, out Vector<int> low, out Vector<int> high)
569 {
571 int* ptr = stackalloc int[count / 2];
572 for (int i = 0; i < count / 2; i++)
573 {
574 ptr[i] = source[i];
575 }
576 int* ptr2 = stackalloc int[count / 2];
577 for (int j = 0; j < count / 2; j++)
578 {
579 ptr2[j] = source[j + count / 2];
580 }
581 low = *(Vector<int>*)ptr;
582 high = *(Vector<int>*)ptr2;
583 }
584
585 [Intrinsic]
586 public unsafe static void Widen(Vector<int> source, out Vector<long> low, out Vector<long> high)
587 {
588 int count = Vector<int>.Count;
589 long* ptr = stackalloc long[count / 2];
590 for (int i = 0; i < count / 2; i++)
591 {
592 ptr[i] = source[i];
593 }
594 long* ptr2 = stackalloc long[count / 2];
595 for (int j = 0; j < count / 2; j++)
596 {
597 ptr2[j] = source[j + count / 2];
598 }
599 low = *(Vector<long>*)ptr;
600 high = *(Vector<long>*)ptr2;
601 }
602
603 [Intrinsic]
604 public unsafe static void Widen(Vector<float> source, out Vector<double> low, out Vector<double> high)
605 {
607 double* ptr = stackalloc double[count / 2];
608 for (int i = 0; i < count / 2; i++)
609 {
610 ptr[i] = source[i];
611 }
612 double* ptr2 = stackalloc double[count / 2];
613 for (int j = 0; j < count / 2; j++)
614 {
615 ptr2[j] = source[j + count / 2];
616 }
617 low = *(Vector<double>*)ptr;
618 high = *(Vector<double>*)ptr2;
619 }
620
621 [CLSCompliant(false)]
622 [Intrinsic]
623 public unsafe static Vector<byte> Narrow(Vector<ushort> low, Vector<ushort> high)
624 {
626 byte* ptr = stackalloc byte[(int)(uint)count];
627 for (int i = 0; i < count / 2; i++)
628 {
629 ptr[i] = (byte)low[i];
630 }
631 for (int j = 0; j < count / 2; j++)
632 {
633 ptr[j + count / 2] = (byte)high[j];
634 }
635 return *(Vector<byte>*)ptr;
636 }
637
638 [CLSCompliant(false)]
639 [Intrinsic]
640 public unsafe static Vector<ushort> Narrow(Vector<uint> low, Vector<uint> high)
641 {
643 ushort* ptr = stackalloc ushort[count];
644 for (int i = 0; i < count / 2; i++)
645 {
646 ptr[i] = (ushort)low[i];
647 }
648 for (int j = 0; j < count / 2; j++)
649 {
650 ptr[j + count / 2] = (ushort)high[j];
651 }
652 return *(Vector<ushort>*)ptr;
653 }
654
655 [CLSCompliant(false)]
656 [Intrinsic]
657 public unsafe static Vector<uint> Narrow(Vector<ulong> low, Vector<ulong> high)
658 {
660 uint* ptr = stackalloc uint[count];
661 for (int i = 0; i < count / 2; i++)
662 {
663 ptr[i] = (uint)low[i];
664 }
665 for (int j = 0; j < count / 2; j++)
666 {
667 ptr[j + count / 2] = (uint)high[j];
668 }
669 return *(Vector<uint>*)ptr;
670 }
671
672 [CLSCompliant(false)]
673 [Intrinsic]
674 public unsafe static Vector<sbyte> Narrow(Vector<short> low, Vector<short> high)
675 {
677 sbyte* ptr = stackalloc sbyte[(int)(uint)count];
678 for (int i = 0; i < count / 2; i++)
679 {
680 ptr[i] = (sbyte)low[i];
681 }
682 for (int j = 0; j < count / 2; j++)
683 {
684 ptr[j + count / 2] = (sbyte)high[j];
685 }
686 return *(Vector<sbyte>*)ptr;
687 }
688
689 [Intrinsic]
690 public unsafe static Vector<short> Narrow(Vector<int> low, Vector<int> high)
691 {
693 short* ptr = stackalloc short[count];
694 for (int i = 0; i < count / 2; i++)
695 {
696 ptr[i] = (short)low[i];
697 }
698 for (int j = 0; j < count / 2; j++)
699 {
700 ptr[j + count / 2] = (short)high[j];
701 }
702 return *(Vector<short>*)ptr;
703 }
704
705 [Intrinsic]
706 public unsafe static Vector<int> Narrow(Vector<long> low, Vector<long> high)
707 {
708 int count = Vector<int>.Count;
709 int* ptr = stackalloc int[count];
710 for (int i = 0; i < count / 2; i++)
711 {
712 ptr[i] = (int)low[i];
713 }
714 for (int j = 0; j < count / 2; j++)
715 {
716 ptr[j + count / 2] = (int)high[j];
717 }
718 return *(Vector<int>*)ptr;
719 }
720
721 [Intrinsic]
722 public unsafe static Vector<float> Narrow(Vector<double> low, Vector<double> high)
723 {
725 float* ptr = stackalloc float[count];
726 for (int i = 0; i < count / 2; i++)
727 {
728 ptr[i] = (float)low[i];
729 }
730 for (int j = 0; j < count / 2; j++)
731 {
732 ptr[j + count / 2] = (float)high[j];
733 }
734 return *(Vector<float>*)ptr;
735 }
736
737 [Intrinsic]
739 {
741 float* ptr = stackalloc float[count];
742 for (int i = 0; i < count; i++)
743 {
744 ptr[i] = value[i];
745 }
746 return *(Vector<float>*)ptr;
747 }
748
749 [CLSCompliant(false)]
750 [Intrinsic]
752 {
754 float* ptr = stackalloc float[count];
755 for (int i = 0; i < count; i++)
756 {
757 ptr[i] = value[i];
758 }
759 return *(Vector<float>*)ptr;
760 }
761
762 [Intrinsic]
764 {
766 double* ptr = stackalloc double[count];
767 for (int i = 0; i < count; i++)
768 {
769 ptr[i] = value[i];
770 }
771 return *(Vector<double>*)ptr;
772 }
773
774 [CLSCompliant(false)]
775 [Intrinsic]
777 {
779 double* ptr = stackalloc double[count];
780 for (int i = 0; i < count; i++)
781 {
782 ptr[i] = value[i];
783 }
784 return *(Vector<double>*)ptr;
785 }
786
787 [Intrinsic]
789 {
790 int count = Vector<int>.Count;
791 int* ptr = stackalloc int[count];
792 for (int i = 0; i < count; i++)
793 {
794 ptr[i] = (int)value[i];
795 }
796 return *(Vector<int>*)ptr;
797 }
798
799 [CLSCompliant(false)]
800 [Intrinsic]
802 {
804 uint* ptr = stackalloc uint[count];
805 for (int i = 0; i < count; i++)
806 {
807 ptr[i] = (uint)value[i];
808 }
809 return *(Vector<uint>*)ptr;
810 }
811
812 [Intrinsic]
814 {
816 long* ptr = stackalloc long[count];
817 for (int i = 0; i < count; i++)
818 {
819 ptr[i] = (long)value[i];
820 }
821 return *(Vector<long>*)ptr;
822 }
823
824 [CLSCompliant(false)]
825 [Intrinsic]
827 {
829 ulong* ptr = stackalloc ulong[count];
830 for (int i = 0; i < count; i++)
831 {
832 ptr[i] = (ulong)value[i];
833 }
834 return *(Vector<ulong>*)ptr;
835 }
836
837 [DoesNotReturn]
838 internal static void ThrowInsufficientNumberOfElementsException(int requiredElementCount)
839 {
840 throw new IndexOutOfRangeException(SR.Format(SR.Arg_InsufficientNumberOfElements, requiredElementCount, "values"));
841 }
842
843 [MethodImpl(MethodImplOptions.AggressiveInlining)]
844 [Intrinsic]
845 public static Vector<TTo> As<TFrom, TTo>(this Vector<TFrom> vector) where TFrom : struct where TTo : struct
846 {
847 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<TFrom>();
848 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<TTo>();
849 return Unsafe.As<Vector<TFrom>, Vector<TTo>>(ref vector);
850 }
851
852 [Intrinsic]
853 public static T Sum<T>(Vector<T> value) where T : struct
854 {
855 return Vector<T>.Sum(value);
856 }
857}
858[Intrinsic]
859public struct Vector<T> : IEquatable<Vector<T>>, IFormattable where T : struct
860{
861 private Register register;
862
863 public static int Count
864 {
865 [Intrinsic]
866 get
867 {
868 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
869 return Unsafe.SizeOf<Vector<T>>() / Unsafe.SizeOf<T>();
870 }
871 }
872
873 public static Vector<T> Zero
874 {
875 [Intrinsic]
876 get
877 {
878 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
879 return default(Vector<T>);
880 }
881 }
882
883 public static Vector<T> One
884 {
885 [Intrinsic]
886 get
887 {
888 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
889 return new Vector<T>(GetOneValue());
890 }
891 }
892
893 internal static Vector<T> AllBitsSet
894 {
895 [Intrinsic]
896 get
897 {
898 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
899 return new Vector<T>(GetAllBitsSetValue());
900 }
901 }
902
903 public readonly T this[int index]
904 {
905 [Intrinsic]
906 get
907 {
908 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
909 if ((uint)index >= (uint)Count)
910 {
912 }
913 return GetElement(index);
914 }
915 }
916
917 [Intrinsic]
918 public Vector(T value)
919 {
920 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
921 Unsafe.SkipInit<Vector<T>>(out this);
922 for (nint num = 0; num < Count; num++)
923 {
924 SetElement(num, value);
925 }
926 }
927
928 [Intrinsic]
929 public Vector(T[] values)
930 : this(values, 0)
931 {
932 }
933
934 [Intrinsic]
935 public Vector(T[] values, int index)
936 {
937 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
938 if (values == null)
939 {
941 }
942 if (index < 0 || values.Length - index < Count)
943 {
945 }
946 this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[index]));
947 }
948
949 [MethodImpl(MethodImplOptions.AggressiveInlining)]
951 {
952 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
953 if (values.Length < Vector<byte>.Count)
954 {
956 }
957 this = Unsafe.ReadUnaligned<Vector<T>>(ref MemoryMarshal.GetReference(values));
958 }
959
960 [MethodImpl(MethodImplOptions.AggressiveInlining)]
962 {
963 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
964 if (values.Length < Count)
965 {
967 }
968 this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
969 }
970
971 [MethodImpl(MethodImplOptions.AggressiveInlining)]
973 : this((ReadOnlySpan<T>)values)
974 {
975 }
976
977 public readonly void CopyTo(Span<byte> destination)
978 {
979 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
980 if ((uint)destination.Length < (uint)Vector<byte>.Count)
981 {
983 }
984 Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this);
985 }
986
987 public readonly void CopyTo(Span<T> destination)
988 {
989 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
990 if ((uint)destination.Length < (uint)Count)
991 {
993 }
994 Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
995 }
996
997 [Intrinsic]
998 public readonly void CopyTo(T[] destination)
999 {
1000 CopyTo(destination, 0);
1001 }
1002
1003 [Intrinsic]
1004 public readonly void CopyTo(T[] destination, int startIndex)
1005 {
1006 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1007 if (destination == null)
1008 {
1010 }
1011 if ((uint)startIndex >= (uint)destination.Length)
1012 {
1014 }
1015 if (destination.Length - startIndex < Count)
1016 {
1018 }
1019 Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), this);
1020 }
1021
1022 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1023 public override readonly bool Equals([NotNullWhen(true)] object? obj)
1024 {
1025 if (obj is Vector<T> other)
1026 {
1027 return Equals(other);
1028 }
1029 return false;
1030 }
1031
1032 [Intrinsic]
1033 public readonly bool Equals(Vector<T> other)
1034 {
1035 return this == other;
1036 }
1037
1038 public override readonly int GetHashCode()
1039 {
1040 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1041 HashCode hashCode = default(HashCode);
1042 for (nint num = 0; num < Count; num++)
1043 {
1044 hashCode.Add(GetElement(num));
1045 }
1046 return hashCode.ToHashCode();
1047 }
1048
1049 public override readonly string ToString()
1050 {
1051 return ToString("G", CultureInfo.CurrentCulture);
1052 }
1053
1054 public readonly string ToString(string? format)
1055 {
1057 }
1058
1059 public readonly string ToString(string? format, IFormatProvider? formatProvider)
1060 {
1061 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1062 StringBuilder stringBuilder = new StringBuilder();
1063 string numberGroupSeparator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
1064 stringBuilder.Append('<');
1065 for (int i = 0; i < Count - 1; i++)
1066 {
1067 stringBuilder.Append(((IFormattable)(object)GetElement(i)).ToString(format, formatProvider));
1068 stringBuilder.Append(numberGroupSeparator);
1069 stringBuilder.Append(' ');
1070 }
1071 stringBuilder.Append(((IFormattable)(object)GetElement(Count - 1)).ToString(format, formatProvider));
1072 stringBuilder.Append('>');
1073 return stringBuilder.ToString();
1074 }
1075
1076 public readonly bool TryCopyTo(Span<byte> destination)
1077 {
1078 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1079 if ((uint)destination.Length < (uint)Vector<byte>.Count)
1080 {
1081 return false;
1082 }
1083 Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this);
1084 return true;
1085 }
1086
1087 public readonly bool TryCopyTo(Span<T> destination)
1088 {
1089 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1090 if ((uint)destination.Length < (uint)Count)
1091 {
1092 return false;
1093 }
1094 Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
1095 return true;
1096 }
1097
1098 [Intrinsic]
1099 public static Vector<T> operator +(Vector<T> left, Vector<T> right)
1100 {
1101 Vector<T> result = default(Vector<T>);
1102 for (nint num = 0; num < Count; num++)
1103 {
1104 result.SetElement(num, ScalarAdd(left.GetElement(num), right.GetElement(num)));
1105 }
1106 return result;
1107 }
1108
1109 [Intrinsic]
1110 public static Vector<T> operator -(Vector<T> left, Vector<T> right)
1111 {
1112 Vector<T> result = default(Vector<T>);
1113 for (nint num = 0; num < Count; num++)
1114 {
1115 result.SetElement(num, ScalarSubtract(left.GetElement(num), right.GetElement(num)));
1116 }
1117 return result;
1118 }
1119
1120 [Intrinsic]
1121 public static Vector<T> operator *(Vector<T> left, Vector<T> right)
1122 {
1123 Vector<T> result = default(Vector<T>);
1124 for (nint num = 0; num < Count; num++)
1125 {
1126 result.SetElement(num, ScalarMultiply(left.GetElement(num), right.GetElement(num)));
1127 }
1128 return result;
1129 }
1130
1131 [Intrinsic]
1132 public static Vector<T> operator *(Vector<T> value, T factor)
1133 {
1134 Vector<T> result = default(Vector<T>);
1135 for (nint num = 0; num < Count; num++)
1136 {
1137 result.SetElement(num, ScalarMultiply(value.GetElement(num), factor));
1138 }
1139 return result;
1140 }
1141
1142 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1143 [Intrinsic]
1144 public static Vector<T> operator *(T factor, Vector<T> value)
1145 {
1146 return value * factor;
1147 }
1148
1149 [Intrinsic]
1150 public static Vector<T> operator /(Vector<T> left, Vector<T> right)
1151 {
1152 Vector<T> result = default(Vector<T>);
1153 for (nint num = 0; num < Count; num++)
1154 {
1155 result.SetElement(num, ScalarDivide(left.GetElement(num), right.GetElement(num)));
1156 }
1157 return result;
1158 }
1159
1160 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1162 {
1163 return Zero - value;
1164 }
1165
1166 [Intrinsic]
1167 public static Vector<T> operator &(Vector<T> left, Vector<T> right)
1168 {
1169 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1170 Vector<T> result = default(Vector<T>);
1171 result.register.uint64_0 = left.register.uint64_0 & right.register.uint64_0;
1172 result.register.uint64_1 = left.register.uint64_1 & right.register.uint64_1;
1173 return result;
1174 }
1175
1176 [Intrinsic]
1177 public static Vector<T> operator |(Vector<T> left, Vector<T> right)
1178 {
1179 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1180 Vector<T> result = default(Vector<T>);
1181 result.register.uint64_0 = left.register.uint64_0 | right.register.uint64_0;
1182 result.register.uint64_1 = left.register.uint64_1 | right.register.uint64_1;
1183 return result;
1184 }
1185
1186 [Intrinsic]
1187 public static Vector<T> operator ^(Vector<T> left, Vector<T> right)
1188 {
1189 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1190 Vector<T> result = default(Vector<T>);
1191 result.register.uint64_0 = left.register.uint64_0 ^ right.register.uint64_0;
1192 result.register.uint64_1 = left.register.uint64_1 ^ right.register.uint64_1;
1193 return result;
1194 }
1195
1196 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1198 {
1199 return AllBitsSet ^ value;
1200 }
1201
1202 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1203 [Intrinsic]
1204 public static bool operator ==(Vector<T> left, Vector<T> right)
1205 {
1206 for (nint num = 0; num < Count; num++)
1207 {
1208 if (!ScalarEquals(left.GetElement(num), right.GetElement(num)))
1209 {
1210 return false;
1211 }
1212 }
1213 return true;
1214 }
1215
1216 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1217 [Intrinsic]
1218 public static bool operator !=(Vector<T> left, Vector<T> right)
1219 {
1220 return !(left == right);
1221 }
1222
1223 [Intrinsic]
1224 public static explicit operator Vector<byte>(Vector<T> value)
1225 {
1226 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1227 return Unsafe.As<Vector<T>, Vector<byte>>(ref value);
1228 }
1229
1230 [CLSCompliant(false)]
1231 [Intrinsic]
1232 public static explicit operator Vector<sbyte>(Vector<T> value)
1233 {
1234 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1235 return Unsafe.As<Vector<T>, Vector<sbyte>>(ref value);
1236 }
1237
1238 [CLSCompliant(false)]
1239 [Intrinsic]
1240 public static explicit operator Vector<ushort>(Vector<T> value)
1241 {
1242 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1243 return Unsafe.As<Vector<T>, Vector<ushort>>(ref value);
1244 }
1245
1246 [Intrinsic]
1247 public static explicit operator Vector<short>(Vector<T> value)
1248 {
1249 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1250 return Unsafe.As<Vector<T>, Vector<short>>(ref value);
1251 }
1252
1253 [CLSCompliant(false)]
1254 [Intrinsic]
1255 public static explicit operator Vector<uint>(Vector<T> value)
1256 {
1257 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1258 return Unsafe.As<Vector<T>, Vector<uint>>(ref value);
1259 }
1260
1261 [Intrinsic]
1262 public static explicit operator Vector<int>(Vector<T> value)
1263 {
1264 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1265 return Unsafe.As<Vector<T>, Vector<int>>(ref value);
1266 }
1267
1268 [CLSCompliant(false)]
1269 [Intrinsic]
1270 public static explicit operator Vector<ulong>(Vector<T> value)
1271 {
1272 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1273 return Unsafe.As<Vector<T>, Vector<ulong>>(ref value);
1274 }
1275
1276 [Intrinsic]
1277 public static explicit operator Vector<long>(Vector<T> value)
1278 {
1279 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1280 return Unsafe.As<Vector<T>, Vector<long>>(ref value);
1281 }
1282
1283 [Intrinsic]
1284 public static explicit operator Vector<float>(Vector<T> value)
1285 {
1286 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1287 return Unsafe.As<Vector<T>, Vector<float>>(ref value);
1288 }
1289
1290 [Intrinsic]
1291 public static explicit operator Vector<double>(Vector<T> value)
1292 {
1293 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1294 return Unsafe.As<Vector<T>, Vector<double>>(ref value);
1295 }
1296
1297 [CLSCompliant(false)]
1298 [Intrinsic]
1299 public static explicit operator Vector<nuint>(Vector<T> value)
1300 {
1301 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1302 return Unsafe.As<Vector<T>, Vector<UIntPtr>>(ref value);
1303 }
1304
1305 [Intrinsic]
1306 public static explicit operator Vector<nint>(Vector<T> value)
1307 {
1308 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1309 return Unsafe.As<Vector<T>, Vector<IntPtr>>(ref value);
1310 }
1311
1312 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1313 [Intrinsic]
1314 internal static Vector<T> Equals(Vector<T> left, Vector<T> right)
1315 {
1316 Vector<T> result = default(Vector<T>);
1317 for (nint num = 0; num < Count; num++)
1318 {
1319 T value = (ScalarEquals(left.GetElement(num), right.GetElement(num)) ? GetAllBitsSetValue() : default(T));
1320 result.SetElement(num, value);
1321 }
1322 return result;
1323 }
1324
1325 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1326 [Intrinsic]
1327 internal static Vector<T> LessThan(Vector<T> left, Vector<T> right)
1328 {
1329 Vector<T> result = default(Vector<T>);
1330 for (nint num = 0; num < Count; num++)
1331 {
1332 T value = (ScalarLessThan(left.GetElement(num), right.GetElement(num)) ? GetAllBitsSetValue() : default(T));
1333 result.SetElement(num, value);
1334 }
1335 return result;
1336 }
1337
1338 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1339 [Intrinsic]
1340 internal static Vector<T> GreaterThan(Vector<T> left, Vector<T> right)
1341 {
1342 Vector<T> result = default(Vector<T>);
1343 for (nint num = 0; num < Count; num++)
1344 {
1345 T value = (ScalarGreaterThan(left.GetElement(num), right.GetElement(num)) ? GetAllBitsSetValue() : default(T));
1346 result.SetElement(num, value);
1347 }
1348 return result;
1349 }
1350
1351 [Intrinsic]
1353 {
1354 Vector<T> result = default(Vector<T>);
1355 for (nint num = 0; num < Count; num++)
1356 {
1357 T value = (ScalarGreaterThanOrEqual(left.GetElement(num), right.GetElement(num)) ? GetAllBitsSetValue() : default(T));
1358 result.SetElement(num, value);
1359 }
1360 return result;
1361 }
1362
1363 [Intrinsic]
1364 internal static Vector<T> LessThanOrEqual(Vector<T> left, Vector<T> right)
1365 {
1366 Vector<T> result = default(Vector<T>);
1367 for (nint num = 0; num < Count; num++)
1368 {
1369 T value = (ScalarLessThanOrEqual(left.GetElement(num), right.GetElement(num)) ? GetAllBitsSetValue() : default(T));
1370 result.SetElement(num, value);
1371 }
1372 return result;
1373 }
1374
1375 [Intrinsic]
1376 internal static Vector<T> ConditionalSelect(Vector<T> condition, Vector<T> left, Vector<T> right)
1377 {
1378 ThrowHelper.ThrowForUnsupportedNumericsVectorBaseType<T>();
1379 Vector<T> result = default(Vector<T>);
1380 result.register.uint64_0 = (left.register.uint64_0 & condition.register.uint64_0) | (right.register.uint64_0 & ~condition.register.uint64_0);
1381 result.register.uint64_1 = (left.register.uint64_1 & condition.register.uint64_1) | (right.register.uint64_1 & ~condition.register.uint64_1);
1382 return result;
1383 }
1384
1385 [Intrinsic]
1386 internal static Vector<T> Abs(Vector<T> value)
1387 {
1388 if (typeof(T) == typeof(byte))
1389 {
1390 return value;
1391 }
1392 if (typeof(T) == typeof(ushort))
1393 {
1394 return value;
1395 }
1396 if (typeof(T) == typeof(uint))
1397 {
1398 return value;
1399 }
1400 if (typeof(T) == typeof(ulong))
1401 {
1402 return value;
1403 }
1404 if (typeof(T) == typeof(UIntPtr))
1405 {
1406 return value;
1407 }
1408 Vector<T> result = default(Vector<T>);
1409 for (nint num = 0; num < Count; num++)
1410 {
1411 result.SetElement(num, ScalarAbs(value.GetElement(num)));
1412 }
1413 return result;
1414 }
1415
1416 [Intrinsic]
1417 internal static Vector<T> Min(Vector<T> left, Vector<T> right)
1418 {
1419 Vector<T> result = default(Vector<T>);
1420 for (nint num = 0; num < Count; num++)
1421 {
1422 T value = (ScalarLessThan(left.GetElement(num), right.GetElement(num)) ? left.GetElement(num) : right.GetElement(num));
1423 result.SetElement(num, value);
1424 }
1425 return result;
1426 }
1427
1428 [Intrinsic]
1429 internal static Vector<T> Max(Vector<T> left, Vector<T> right)
1430 {
1431 Vector<T> result = default(Vector<T>);
1432 for (nint num = 0; num < Count; num++)
1433 {
1434 T value = (ScalarGreaterThan(left.GetElement(num), right.GetElement(num)) ? left.GetElement(num) : right.GetElement(num));
1435 result.SetElement(num, value);
1436 }
1437 return result;
1438 }
1439
1440 [Intrinsic]
1441 internal static T Dot(Vector<T> left, Vector<T> right)
1442 {
1443 T val = default(T);
1444 for (nint num = 0; num < Count; num++)
1445 {
1446 val = ScalarAdd(val, ScalarMultiply(left.GetElement(num), right.GetElement(num)));
1447 }
1448 return val;
1449 }
1450
1451 [Intrinsic]
1452 internal static T Sum(Vector<T> value)
1453 {
1454 T val = default(T);
1455 for (nint num = 0; num < Count; num++)
1456 {
1457 val = ScalarAdd(val, value.GetElement(num));
1458 }
1459 return val;
1460 }
1461
1462 [Intrinsic]
1464 {
1465 Vector<T> result = default(Vector<T>);
1466 for (nint num = 0; num < Count; num++)
1467 {
1468 result.SetElement(num, ScalarSqrt(value.GetElement(num)));
1469 }
1470 return result;
1471 }
1472
1473 [Intrinsic]
1475 {
1476 Vector<T> result = default(Vector<T>);
1477 for (nint num = 0; num < Count; num++)
1478 {
1479 result.SetElement(num, ScalarCeiling(value.GetElement(num)));
1480 }
1481 return result;
1482 }
1483
1484 [Intrinsic]
1486 {
1487 Vector<T> result = default(Vector<T>);
1488 for (nint num = 0; num < Count; num++)
1489 {
1490 result.SetElement(num, ScalarFloor(value.GetElement(num)));
1491 }
1492 return result;
1493 }
1494
1495 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1496 private static bool ScalarEquals(T left, T right)
1497 {
1498 if (typeof(T) == typeof(byte))
1499 {
1500 return (byte)(object)left == (byte)(object)right;
1501 }
1502 if (typeof(T) == typeof(sbyte))
1503 {
1504 return (sbyte)(object)left == (sbyte)(object)right;
1505 }
1506 if (typeof(T) == typeof(ushort))
1507 {
1508 return (ushort)(object)left == (ushort)(object)right;
1509 }
1510 if (typeof(T) == typeof(short))
1511 {
1512 return (short)(object)left == (short)(object)right;
1513 }
1514 if (typeof(T) == typeof(uint))
1515 {
1516 return (uint)(object)left == (uint)(object)right;
1517 }
1518 if (typeof(T) == typeof(int))
1519 {
1520 return (int)(object)left == (int)(object)right;
1521 }
1522 if (typeof(T) == typeof(ulong))
1523 {
1524 return (ulong)(object)left == (ulong)(object)right;
1525 }
1526 if (typeof(T) == typeof(long))
1527 {
1528 return (long)(object)left == (long)(object)right;
1529 }
1530 if (typeof(T) == typeof(float))
1531 {
1532 return (float)(object)left == (float)(object)right;
1533 }
1534 if (typeof(T) == typeof(double))
1535 {
1536 return (double)(object)left == (double)(object)right;
1537 }
1538 if (typeof(T) == typeof(UIntPtr))
1539 {
1540 return (UIntPtr)(object)left == (UIntPtr)(object)right;
1541 }
1542 if (typeof(T) == typeof(IntPtr))
1543 {
1544 return (IntPtr)(object)left == (IntPtr)(object)right;
1545 }
1547 }
1548
1549 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1550 private static bool ScalarLessThan(T left, T right)
1551 {
1552 if (typeof(T) == typeof(byte))
1553 {
1554 return (byte)(object)left < (byte)(object)right;
1555 }
1556 if (typeof(T) == typeof(sbyte))
1557 {
1558 return (sbyte)(object)left < (sbyte)(object)right;
1559 }
1560 if (typeof(T) == typeof(ushort))
1561 {
1562 return (ushort)(object)left < (ushort)(object)right;
1563 }
1564 if (typeof(T) == typeof(short))
1565 {
1566 return (short)(object)left < (short)(object)right;
1567 }
1568 if (typeof(T) == typeof(uint))
1569 {
1570 return (uint)(object)left < (uint)(object)right;
1571 }
1572 if (typeof(T) == typeof(int))
1573 {
1574 return (int)(object)left < (int)(object)right;
1575 }
1576 if (typeof(T) == typeof(ulong))
1577 {
1578 return (ulong)(object)left < (ulong)(object)right;
1579 }
1580 if (typeof(T) == typeof(long))
1581 {
1582 return (long)(object)left < (long)(object)right;
1583 }
1584 if (typeof(T) == typeof(float))
1585 {
1586 return (float)(object)left < (float)(object)right;
1587 }
1588 if (typeof(T) == typeof(double))
1589 {
1590 return (double)(object)left < (double)(object)right;
1591 }
1592 if (typeof(T) == typeof(UIntPtr))
1593 {
1594 return (nuint)(UIntPtr)(object)left < (nuint)(UIntPtr)(object)right;
1595 }
1596 if (typeof(T) == typeof(IntPtr))
1597 {
1598 return (nint)(IntPtr)(object)left < (nint)(IntPtr)(object)right;
1599 }
1601 }
1602
1603 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1604 private static bool ScalarLessThanOrEqual(T left, T right)
1605 {
1606 if (typeof(T) == typeof(byte))
1607 {
1608 return (byte)(object)left <= (byte)(object)right;
1609 }
1610 if (typeof(T) == typeof(sbyte))
1611 {
1612 return (sbyte)(object)left <= (sbyte)(object)right;
1613 }
1614 if (typeof(T) == typeof(ushort))
1615 {
1616 return (ushort)(object)left <= (ushort)(object)right;
1617 }
1618 if (typeof(T) == typeof(short))
1619 {
1620 return (short)(object)left <= (short)(object)right;
1621 }
1622 if (typeof(T) == typeof(uint))
1623 {
1624 return (uint)(object)left <= (uint)(object)right;
1625 }
1626 if (typeof(T) == typeof(int))
1627 {
1628 return (int)(object)left <= (int)(object)right;
1629 }
1630 if (typeof(T) == typeof(ulong))
1631 {
1632 return (ulong)(object)left <= (ulong)(object)right;
1633 }
1634 if (typeof(T) == typeof(long))
1635 {
1636 return (long)(object)left <= (long)(object)right;
1637 }
1638 if (typeof(T) == typeof(float))
1639 {
1640 return (float)(object)left <= (float)(object)right;
1641 }
1642 if (typeof(T) == typeof(double))
1643 {
1644 return (double)(object)left <= (double)(object)right;
1645 }
1646 if (typeof(T) == typeof(UIntPtr))
1647 {
1648 return (nuint)(UIntPtr)(object)left <= (nuint)(UIntPtr)(object)right;
1649 }
1650 if (typeof(T) == typeof(IntPtr))
1651 {
1652 return (nint)(IntPtr)(object)left <= (nint)(IntPtr)(object)right;
1653 }
1655 }
1656
1657 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1658 private static bool ScalarGreaterThan(T left, T right)
1659 {
1660 if (typeof(T) == typeof(byte))
1661 {
1662 return (byte)(object)left > (byte)(object)right;
1663 }
1664 if (typeof(T) == typeof(sbyte))
1665 {
1666 return (sbyte)(object)left > (sbyte)(object)right;
1667 }
1668 if (typeof(T) == typeof(ushort))
1669 {
1670 return (ushort)(object)left > (ushort)(object)right;
1671 }
1672 if (typeof(T) == typeof(short))
1673 {
1674 return (short)(object)left > (short)(object)right;
1675 }
1676 if (typeof(T) == typeof(uint))
1677 {
1678 return (uint)(object)left > (uint)(object)right;
1679 }
1680 if (typeof(T) == typeof(int))
1681 {
1682 return (int)(object)left > (int)(object)right;
1683 }
1684 if (typeof(T) == typeof(ulong))
1685 {
1686 return (ulong)(object)left > (ulong)(object)right;
1687 }
1688 if (typeof(T) == typeof(long))
1689 {
1690 return (long)(object)left > (long)(object)right;
1691 }
1692 if (typeof(T) == typeof(float))
1693 {
1694 return (float)(object)left > (float)(object)right;
1695 }
1696 if (typeof(T) == typeof(double))
1697 {
1698 return (double)(object)left > (double)(object)right;
1699 }
1700 if (typeof(T) == typeof(UIntPtr))
1701 {
1702 return (nuint)(UIntPtr)(object)left > (nuint)(UIntPtr)(object)right;
1703 }
1704 if (typeof(T) == typeof(IntPtr))
1705 {
1706 return (nint)(IntPtr)(object)left > (nint)(IntPtr)(object)right;
1707 }
1709 }
1710
1711 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1712 private static bool ScalarGreaterThanOrEqual(T left, T right)
1713 {
1714 if (typeof(T) == typeof(byte))
1715 {
1716 return (byte)(object)left >= (byte)(object)right;
1717 }
1718 if (typeof(T) == typeof(sbyte))
1719 {
1720 return (sbyte)(object)left >= (sbyte)(object)right;
1721 }
1722 if (typeof(T) == typeof(ushort))
1723 {
1724 return (ushort)(object)left >= (ushort)(object)right;
1725 }
1726 if (typeof(T) == typeof(short))
1727 {
1728 return (short)(object)left >= (short)(object)right;
1729 }
1730 if (typeof(T) == typeof(uint))
1731 {
1732 return (uint)(object)left >= (uint)(object)right;
1733 }
1734 if (typeof(T) == typeof(int))
1735 {
1736 return (int)(object)left >= (int)(object)right;
1737 }
1738 if (typeof(T) == typeof(ulong))
1739 {
1740 return (ulong)(object)left >= (ulong)(object)right;
1741 }
1742 if (typeof(T) == typeof(long))
1743 {
1744 return (long)(object)left >= (long)(object)right;
1745 }
1746 if (typeof(T) == typeof(float))
1747 {
1748 return (float)(object)left >= (float)(object)right;
1749 }
1750 if (typeof(T) == typeof(double))
1751 {
1752 return (double)(object)left >= (double)(object)right;
1753 }
1754 if (typeof(T) == typeof(UIntPtr))
1755 {
1756 return (nuint)(UIntPtr)(object)left >= (nuint)(UIntPtr)(object)right;
1757 }
1758 if (typeof(T) == typeof(IntPtr))
1759 {
1760 return (nint)(IntPtr)(object)left >= (nint)(IntPtr)(object)right;
1761 }
1763 }
1764
1765 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1766 private static T ScalarAdd(T left, T right)
1767 {
1768 if (typeof(T) == typeof(byte))
1769 {
1770 return (T)(object)(byte)((byte)(object)left + (byte)(object)right);
1771 }
1772 if (typeof(T) == typeof(sbyte))
1773 {
1774 return (T)(object)(sbyte)((sbyte)(object)left + (sbyte)(object)right);
1775 }
1776 if (typeof(T) == typeof(ushort))
1777 {
1778 return (T)(object)(ushort)((ushort)(object)left + (ushort)(object)right);
1779 }
1780 if (typeof(T) == typeof(short))
1781 {
1782 return (T)(object)(short)((short)(object)left + (short)(object)right);
1783 }
1784 if (typeof(T) == typeof(uint))
1785 {
1786 return (T)(object)((uint)(object)left + (uint)(object)right);
1787 }
1788 if (typeof(T) == typeof(int))
1789 {
1790 return (T)(object)((int)(object)left + (int)(object)right);
1791 }
1792 if (typeof(T) == typeof(ulong))
1793 {
1794 return (T)(object)((ulong)(object)left + (ulong)(object)right);
1795 }
1796 if (typeof(T) == typeof(long))
1797 {
1798 return (T)(object)((long)(object)left + (long)(object)right);
1799 }
1800 if (typeof(T) == typeof(float))
1801 {
1802 return (T)(object)((float)(object)left + (float)(object)right);
1803 }
1804 if (typeof(T) == typeof(double))
1805 {
1806 return (T)(object)((double)(object)left + (double)(object)right);
1807 }
1808 if (typeof(T) == typeof(UIntPtr))
1809 {
1810 return (T)(object)(nuint)((nint)(nuint)(UIntPtr)(object)left + (nint)(nuint)(UIntPtr)(object)right);
1811 }
1812 if (typeof(T) == typeof(IntPtr))
1813 {
1814 return (T)(object)((nint)(IntPtr)(object)left + (nint)(IntPtr)(object)right);
1815 }
1817 }
1818
1819 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1820 private static T ScalarSubtract(T left, T right)
1821 {
1822 if (typeof(T) == typeof(byte))
1823 {
1824 return (T)(object)(byte)((byte)(object)left - (byte)(object)right);
1825 }
1826 if (typeof(T) == typeof(sbyte))
1827 {
1828 return (T)(object)(sbyte)((sbyte)(object)left - (sbyte)(object)right);
1829 }
1830 if (typeof(T) == typeof(ushort))
1831 {
1832 return (T)(object)(ushort)((ushort)(object)left - (ushort)(object)right);
1833 }
1834 if (typeof(T) == typeof(short))
1835 {
1836 return (T)(object)(short)((short)(object)left - (short)(object)right);
1837 }
1838 if (typeof(T) == typeof(uint))
1839 {
1840 return (T)(object)((uint)(object)left - (uint)(object)right);
1841 }
1842 if (typeof(T) == typeof(int))
1843 {
1844 return (T)(object)((int)(object)left - (int)(object)right);
1845 }
1846 if (typeof(T) == typeof(ulong))
1847 {
1848 return (T)(object)((ulong)(object)left - (ulong)(object)right);
1849 }
1850 if (typeof(T) == typeof(long))
1851 {
1852 return (T)(object)((long)(object)left - (long)(object)right);
1853 }
1854 if (typeof(T) == typeof(float))
1855 {
1856 return (T)(object)((float)(object)left - (float)(object)right);
1857 }
1858 if (typeof(T) == typeof(double))
1859 {
1860 return (T)(object)((double)(object)left - (double)(object)right);
1861 }
1862 if (typeof(T) == typeof(UIntPtr))
1863 {
1864 return (T)(object)(nuint)((nint)(nuint)(UIntPtr)(object)left - (nint)(nuint)(UIntPtr)(object)right);
1865 }
1866 if (typeof(T) == typeof(IntPtr))
1867 {
1868 return (T)(object)((nint)(IntPtr)(object)left - (nint)(IntPtr)(object)right);
1869 }
1871 }
1872
1873 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1874 private static T ScalarMultiply(T left, T right)
1875 {
1876 if (typeof(T) == typeof(byte))
1877 {
1878 return (T)(object)(byte)((byte)(object)left * (byte)(object)right);
1879 }
1880 if (typeof(T) == typeof(sbyte))
1881 {
1882 return (T)(object)(sbyte)((sbyte)(object)left * (sbyte)(object)right);
1883 }
1884 if (typeof(T) == typeof(ushort))
1885 {
1886 return (T)(object)(ushort)((ushort)(object)left * (ushort)(object)right);
1887 }
1888 if (typeof(T) == typeof(short))
1889 {
1890 return (T)(object)(short)((short)(object)left * (short)(object)right);
1891 }
1892 if (typeof(T) == typeof(uint))
1893 {
1894 return (T)(object)((uint)(object)left * (uint)(object)right);
1895 }
1896 if (typeof(T) == typeof(int))
1897 {
1898 return (T)(object)((int)(object)left * (int)(object)right);
1899 }
1900 if (typeof(T) == typeof(ulong))
1901 {
1902 return (T)(object)((ulong)(object)left * (ulong)(object)right);
1903 }
1904 if (typeof(T) == typeof(long))
1905 {
1906 return (T)(object)((long)(object)left * (long)(object)right);
1907 }
1908 if (typeof(T) == typeof(float))
1909 {
1910 return (T)(object)((float)(object)left * (float)(object)right);
1911 }
1912 if (typeof(T) == typeof(double))
1913 {
1914 return (T)(object)((double)(object)left * (double)(object)right);
1915 }
1916 if (typeof(T) == typeof(UIntPtr))
1917 {
1918 return (T)(object)(nuint)((nint)(nuint)(UIntPtr)(object)left * (nint)(nuint)(UIntPtr)(object)right);
1919 }
1920 if (typeof(T) == typeof(IntPtr))
1921 {
1922 return (T)(object)((nint)(IntPtr)(object)left * (nint)(IntPtr)(object)right);
1923 }
1925 }
1926
1927 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1928 private static T ScalarDivide(T left, T right)
1929 {
1930 if (typeof(T) == typeof(byte))
1931 {
1932 return (T)(object)(byte)((byte)(object)left / (byte)(object)right);
1933 }
1934 if (typeof(T) == typeof(sbyte))
1935 {
1936 return (T)(object)(sbyte)((sbyte)(object)left / (sbyte)(object)right);
1937 }
1938 if (typeof(T) == typeof(ushort))
1939 {
1940 return (T)(object)(ushort)((ushort)(object)left / (ushort)(object)right);
1941 }
1942 if (typeof(T) == typeof(short))
1943 {
1944 return (T)(object)(short)((short)(object)left / (short)(object)right);
1945 }
1946 if (typeof(T) == typeof(uint))
1947 {
1948 return (T)(object)((uint)(object)left / (uint)(object)right);
1949 }
1950 if (typeof(T) == typeof(int))
1951 {
1952 return (T)(object)((int)(object)left / (int)(object)right);
1953 }
1954 if (typeof(T) == typeof(ulong))
1955 {
1956 return (T)(object)((ulong)(object)left / (ulong)(object)right);
1957 }
1958 if (typeof(T) == typeof(long))
1959 {
1960 return (T)(object)((long)(object)left / (long)(object)right);
1961 }
1962 if (typeof(T) == typeof(float))
1963 {
1964 return (T)(object)((float)(object)left / (float)(object)right);
1965 }
1966 if (typeof(T) == typeof(double))
1967 {
1968 return (T)(object)((double)(object)left / (double)(object)right);
1969 }
1970 if (typeof(T) == typeof(UIntPtr))
1971 {
1972 return (T)(object)((nuint)(UIntPtr)(object)left / (nuint)(UIntPtr)(object)right);
1973 }
1974 if (typeof(T) == typeof(IntPtr))
1975 {
1976 return (T)(object)((nint)(IntPtr)(object)left / (nint)(IntPtr)(object)right);
1977 }
1979 }
1980
1981 [MethodImpl(MethodImplOptions.AggressiveInlining)]
1982 private static T GetOneValue()
1983 {
1984 if (typeof(T) == typeof(byte))
1985 {
1986 return (T)(object)(byte)1;
1987 }
1988 if (typeof(T) == typeof(sbyte))
1989 {
1990 return (T)(object)(sbyte)1;
1991 }
1992 if (typeof(T) == typeof(ushort))
1993 {
1994 return (T)(object)(ushort)1;
1995 }
1996 if (typeof(T) == typeof(short))
1997 {
1998 return (T)(object)(short)1;
1999 }
2000 if (typeof(T) == typeof(uint))
2001 {
2002 return (T)(object)1u;
2003 }
2004 if (typeof(T) == typeof(int))
2005 {
2006 return (T)(object)1;
2007 }
2008 if (typeof(T) == typeof(ulong))
2009 {
2010 return (T)(object)1uL;
2011 }
2012 if (typeof(T) == typeof(long))
2013 {
2014 return (T)(object)1L;
2015 }
2016 if (typeof(T) == typeof(float))
2017 {
2018 return (T)(object)1f;
2019 }
2020 if (typeof(T) == typeof(double))
2021 {
2022 return (T)(object)1.0;
2023 }
2024 if (typeof(T) == typeof(UIntPtr))
2025 {
2026 return (T)(object)(nuint)1u;
2027 }
2028 if (typeof(T) == typeof(IntPtr))
2029 {
2030 return (T)(object)(nint)1;
2031 }
2033 }
2034
2035 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2036 private static T GetAllBitsSetValue()
2037 {
2038 if (typeof(T) == typeof(byte))
2039 {
2040 return (T)(object)byte.MaxValue;
2041 }
2042 if (typeof(T) == typeof(sbyte))
2043 {
2044 return (T)(object)(sbyte)(-1);
2045 }
2046 if (typeof(T) == typeof(ushort))
2047 {
2048 return (T)(object)ushort.MaxValue;
2049 }
2050 if (typeof(T) == typeof(short))
2051 {
2052 return (T)(object)(short)(-1);
2053 }
2054 if (typeof(T) == typeof(uint))
2055 {
2056 return (T)(object)uint.MaxValue;
2057 }
2058 if (typeof(T) == typeof(int))
2059 {
2060 return (T)(object)(-1);
2061 }
2062 if (typeof(T) == typeof(ulong))
2063 {
2064 return (T)(object)ulong.MaxValue;
2065 }
2066 if (typeof(T) == typeof(long))
2067 {
2068 return (T)(object)(-1L);
2069 }
2070 if (typeof(T) == typeof(float))
2071 {
2072 return (T)(object)BitConverter.Int32BitsToSingle(-1);
2073 }
2074 if (typeof(T) == typeof(double))
2075 {
2076 return (T)(object)BitConverter.Int64BitsToDouble(-1L);
2077 }
2078 if (typeof(T) == typeof(UIntPtr))
2079 {
2080 return (T)(object)UIntPtr.MaxValue;
2081 }
2082 if (typeof(T) == typeof(IntPtr))
2083 {
2084 return (T)(object)(nint)(-1);
2085 }
2087 }
2088
2089 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2090 private static T ScalarAbs(T value)
2091 {
2092 if (typeof(T) == typeof(sbyte))
2093 {
2094 return (T)(object)Math.Abs((sbyte)(object)value);
2095 }
2096 if (typeof(T) == typeof(short))
2097 {
2098 return (T)(object)Math.Abs((short)(object)value);
2099 }
2100 if (typeof(T) == typeof(int))
2101 {
2102 return (T)(object)Math.Abs((int)(object)value);
2103 }
2104 if (typeof(T) == typeof(long))
2105 {
2106 return (T)(object)Math.Abs((long)(object)value);
2107 }
2108 if (typeof(T) == typeof(float))
2109 {
2110 return (T)(object)Math.Abs((float)(object)value);
2111 }
2112 if (typeof(T) == typeof(double))
2113 {
2114 return (T)(object)Math.Abs((double)(object)value);
2115 }
2116 if (typeof(T) == typeof(IntPtr))
2117 {
2118 return (T)(object)Math.Abs((IntPtr)(object)value);
2119 }
2121 }
2122
2123 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2124 private static T ScalarSqrt(T value)
2125 {
2126 if (typeof(T) == typeof(byte))
2127 {
2128 return (T)(object)(byte)Math.Sqrt((int)(byte)(object)value);
2129 }
2130 if (typeof(T) == typeof(sbyte))
2131 {
2132 return (T)(object)(sbyte)Math.Sqrt((sbyte)(object)value);
2133 }
2134 if (typeof(T) == typeof(ushort))
2135 {
2136 return (T)(object)(ushort)Math.Sqrt((int)(ushort)(object)value);
2137 }
2138 if (typeof(T) == typeof(short))
2139 {
2140 return (T)(object)(short)Math.Sqrt((short)(object)value);
2141 }
2142 if (typeof(T) == typeof(uint))
2143 {
2144 return (T)(object)(uint)Math.Sqrt((uint)(object)value);
2145 }
2146 if (typeof(T) == typeof(int))
2147 {
2148 return (T)(object)(int)Math.Sqrt((int)(object)value);
2149 }
2150 if (typeof(T) == typeof(ulong))
2151 {
2152 return (T)(object)(ulong)Math.Sqrt((ulong)(object)value);
2153 }
2154 if (typeof(T) == typeof(long))
2155 {
2156 return (T)(object)(long)Math.Sqrt((long)(object)value);
2157 }
2158 if (typeof(T) == typeof(float))
2159 {
2160 return (T)(object)(float)Math.Sqrt((float)(object)value);
2161 }
2162 if (typeof(T) == typeof(double))
2163 {
2164 return (T)(object)Math.Sqrt((double)(object)value);
2165 }
2166 if (typeof(T) == typeof(UIntPtr))
2167 {
2168 return (T)(object)(UIntPtr)Math.Sqrt((nint)(nuint)(UIntPtr)(object)value);
2169 }
2170 if (typeof(T) == typeof(IntPtr))
2171 {
2172 return (T)(object)(IntPtr)Math.Sqrt((nint)(IntPtr)(object)value);
2173 }
2175 }
2176
2177 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2178 private static T ScalarCeiling(T value)
2179 {
2180 if (typeof(T) == typeof(float))
2181 {
2182 return (T)(object)MathF.Ceiling((float)(object)value);
2183 }
2184 if (typeof(T) == typeof(double))
2185 {
2186 return (T)(object)Math.Ceiling((double)(object)value);
2187 }
2189 }
2190
2191 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2192 private static T ScalarFloor(T value)
2193 {
2194 if (typeof(T) == typeof(float))
2195 {
2196 return (T)(object)MathF.Floor((float)(object)value);
2197 }
2198 if (typeof(T) == typeof(double))
2199 {
2200 return (T)(object)Math.Floor((double)(object)value);
2201 }
2203 }
2204
2205 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2206 private readonly T GetElement(nint index)
2207 {
2208 return Unsafe.Add(ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in this)), index);
2209 }
2210
2211 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2212 private void SetElement(nint index, T value)
2213 {
2214 Unsafe.Add(ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in this)), index) = value;
2215 }
2216}
static unsafe float Int32BitsToSingle(int value)
static unsafe double Int64BitsToDouble(long value)
static CultureInfo CurrentCulture
static NumberFormatInfo GetInstance(IFormatProvider? formatProvider)
static float Ceiling(float x)
static float Floor(float x)
static double Sqrt(double d)
static double Ceiling(double a)
static double Abs(double value)
static double Floor(double d)
static T ScalarAdd(T left, T right)
Definition Vector.cs:1766
static unsafe Vector< sbyte > Narrow(Vector< short > low, Vector< short > high)
Definition Vector.cs:674
static Vector< long > Equals(Vector< double > left, Vector< double > right)
Definition Vector.cs:66
static Vector< T > operator/(Vector< T > left, Vector< T > right)
Definition Vector.cs:1150
static Vector< T > BitwiseOr< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:390
static T ScalarSubtract(T left, T right)
Definition Vector.cs:1820
static bool GreaterThanAny< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:226
static Vector< float > ConditionalSelect(Vector< int > condition, Vector< float > left, Vector< float > right)
Definition Vector.cs:24
static Vector< T > GreaterThan< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:186
static Vector< T > Max(Vector< T > left, Vector< T > right)
Definition Vector.cs:1429
static T Sum(Vector< T > value)
Definition Vector.cs:1452
static Vector< T > AndNot< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:409
static Vector< T > ConditionalSelect< T >(Vector< T > condition, Vector< T > left, Vector< T > right)
Definition Vector.cs:38
static Vector< T > OnesComplement< T >(Vector< T > value)
Definition Vector.cs:396
Vector(Span< T > values)
Definition Vector.cs:972
static Vector< T > operator&(Vector< T > left, Vector< T > right)
Definition Vector.cs:1167
static Vector< ulong > AsVectorUInt64< T >(Vector< T > value)
Definition Vector.cs:455
static Vector< int > Equals(Vector< int > left, Vector< int > right)
Definition Vector.cs:59
static Vector< T > Zero
Definition Vector.cs:874
static unsafe Vector< int > Narrow(Vector< long > low, Vector< long > high)
Definition Vector.cs:706
static Vector< T > GreaterThanOrEqual< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:233
static unsafe Vector< double > ConvertToDouble(Vector< ulong > value)
Definition Vector.cs:776
static Vector< T > operator*(Vector< T > left, Vector< T > right)
Definition Vector.cs:1121
readonly void CopyTo(Span< T > destination)
Definition Vector.cs:987
static Vector< double > Ceiling(Vector< double > value)
Definition Vector.cs:322
static Vector< T > operator+(Vector< T > left, Vector< T > right)
Definition Vector.cs:1099
static unsafe void Widen(Vector< sbyte > source, out Vector< short > low, out Vector< short > high)
Definition Vector.cs:550
static Vector< T > Equals< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:45
static Vector< float > Floor(Vector< float > value)
Definition Vector.cs:329
static Vector< T > SquareRoot< T >(Vector< T > value)
Definition Vector.cs:308
static unsafe Vector< ulong > ConvertToUInt64(Vector< double > value)
Definition Vector.cs:826
static bool ScalarGreaterThanOrEqual(T left, T right)
Definition Vector.cs:1712
static Vector< T > Negate< T >(Vector< T > value)
Definition Vector.cs:378
readonly void CopyTo(Span< byte > destination)
Definition Vector.cs:977
static Vector< T > operator-(Vector< T > left, Vector< T > right)
Definition Vector.cs:1110
static Vector< int > LessThanOrEqual(Vector< float > left, Vector< float > right)
Definition Vector.cs:146
static unsafe Vector< float > ConvertToSingle(Vector< uint > value)
Definition Vector.cs:751
static bool EqualsAny< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:85
static Vector< T > AllBitsSet
Definition Vector.cs:894
readonly string ToString(string? format)
Definition Vector.cs:1054
readonly bool TryCopyTo(Span< T > destination)
Definition Vector.cs:1087
static bool GreaterThanOrEqualAll< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:267
static Vector< long > GreaterThan(Vector< double > left, Vector< double > right)
Definition Vector.cs:207
static Vector< T > Subtract< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:348
static Vector< long > Equals(Vector< long > left, Vector< long > right)
Definition Vector.cs:73
static Vector< T > Max< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:294
static unsafe void Widen(Vector< uint > source, out Vector< ulong > low, out Vector< ulong > high)
Definition Vector.cs:531
static Vector< int > AsVectorInt32< T >(Vector< T > value)
Definition Vector.cs:448
Vector(ReadOnlySpan< byte > values)
Definition Vector.cs:950
static void ThrowInsufficientNumberOfElementsException(int requiredElementCount)
Definition Vector.cs:838
static Vector< double > ConditionalSelect(Vector< long > condition, Vector< double > left, Vector< double > right)
Definition Vector.cs:31
static Vector< T > Equals(Vector< T > left, Vector< T > right)
Definition Vector.cs:1314
readonly bool TryCopyTo(Span< byte > destination)
Definition Vector.cs:1076
static Vector< T > Add< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:342
Vector(T[] values)
Definition Vector.cs:929
static unsafe Vector< int > ConvertToInt32(Vector< float > value)
Definition Vector.cs:788
static unsafe Vector< float > ConvertToSingle(Vector< int > value)
Definition Vector.cs:738
static Vector< T > Xor< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:402
static Vector< T > Ceiling(Vector< T > value)
Definition Vector.cs:1474
static Vector< T > LessThanOrEqual< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:139
static Vector< T > operator~(Vector< T > value)
Definition Vector.cs:1197
static Vector< int > GreaterThan(Vector< int > left, Vector< int > right)
Definition Vector.cs:200
static T Dot(Vector< T > left, Vector< T > right)
Definition Vector.cs:1441
static Vector< long > LessThanOrEqual(Vector< double > left, Vector< double > right)
Definition Vector.cs:167
static Vector< byte > AsVectorByte< T >(Vector< T > value)
Definition Vector.cs:415
static Vector< double > Floor(Vector< double > value)
Definition Vector.cs:336
static Vector< sbyte > AsVectorSByte< T >(Vector< T > value)
Definition Vector.cs:422
readonly bool Equals(Vector< T > other)
Definition Vector.cs:1033
static T ScalarAbs(T value)
Definition Vector.cs:2090
static Vector< int > LessThan(Vector< float > left, Vector< float > right)
Definition Vector.cs:99
static bool IsHardwareAccelerated
Definition Vector.cs:14
static Vector< long > LessThan(Vector< double > left, Vector< double > right)
Definition Vector.cs:113
readonly void CopyTo(T[] destination, int startIndex)
Definition Vector.cs:1004
void SetElement(nint index, T value)
Definition Vector.cs:2212
static Vector< nuint > AsVectorNUInt< T >(Vector< T > value)
Definition Vector.cs:480
static unsafe Vector< uint > ConvertToUInt32(Vector< float > value)
Definition Vector.cs:801
static bool ScalarLessThan(T left, T right)
Definition Vector.cs:1550
static Vector< T > Min< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:287
static Vector< T > Multiply< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:354
static unsafe Vector< long > ConvertToInt64(Vector< double > value)
Definition Vector.cs:813
static Vector< short > AsVectorInt16< T >(Vector< T > value)
Definition Vector.cs:435
readonly T GetElement(nint index)
Definition Vector.cs:2206
static unsafe Vector< double > ConvertToDouble(Vector< long > value)
Definition Vector.cs:763
static Vector< long > GreaterThan(Vector< long > left, Vector< long > right)
Definition Vector.cs:214
static Vector< ushort > AsVectorUInt16< T >(Vector< T > value)
Definition Vector.cs:429
static unsafe void Widen(Vector< ushort > source, out Vector< uint > low, out Vector< uint > high)
Definition Vector.cs:512
static unsafe void Widen(Vector< byte > source, out Vector< ushort > low, out Vector< ushort > high)
Definition Vector.cs:493
override readonly int GetHashCode()
Definition Vector.cs:1038
static Vector< long > AsVectorInt64< T >(Vector< T > value)
Definition Vector.cs:461
override readonly bool Equals([NotNullWhen(true)] object? obj)
Definition Vector.cs:1023
static T Sum< T >(Vector< T > value)
Definition Vector.cs:853
static T ScalarMultiply(T left, T right)
Definition Vector.cs:1874
static bool LessThanOrEqualAny< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:179
static unsafe Vector< uint > Narrow(Vector< ulong > low, Vector< ulong > high)
Definition Vector.cs:657
static unsafe Vector< byte > Narrow(Vector< ushort > low, Vector< ushort > high)
Definition Vector.cs:623
readonly void CopyTo(T[] destination)
Definition Vector.cs:998
static T Dot< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:301
static Vector< T > SquareRoot(Vector< T > value)
Definition Vector.cs:1463
static T GetOneValue()
Definition Vector.cs:1982
static Vector< float > Ceiling(Vector< float > value)
Definition Vector.cs:315
Vector(ReadOnlySpan< T > values)
Definition Vector.cs:961
static bool LessThanOrEqualAll< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:173
static Vector< T > GreaterThanOrEqual(Vector< T > left, Vector< T > right)
Definition Vector.cs:1352
static Vector< long > GreaterThanOrEqual(Vector< double > left, Vector< double > right)
Definition Vector.cs:261
static Vector< long > GreaterThanOrEqual(Vector< long > left, Vector< long > right)
Definition Vector.cs:254
static Vector< T > Min(Vector< T > left, Vector< T > right)
Definition Vector.cs:1417
static bool ScalarEquals(T left, T right)
Definition Vector.cs:1496
override readonly string ToString()
Definition Vector.cs:1049
static Vector< int > LessThanOrEqual(Vector< int > left, Vector< int > right)
Definition Vector.cs:153
static bool LessThanAny< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:132
Vector(T[] values, int index)
Definition Vector.cs:935
static Vector< int > LessThan(Vector< int > left, Vector< int > right)
Definition Vector.cs:106
static Vector< T > ConditionalSelect(Vector< T > condition, Vector< T > left, Vector< T > right)
Definition Vector.cs:1376
static unsafe void Widen(Vector< short > source, out Vector< int > low, out Vector< int > high)
Definition Vector.cs:568
static bool GreaterThanOrEqualAny< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:273
static Vector< T > GreaterThan(Vector< T > left, Vector< T > right)
Definition Vector.cs:1340
static unsafe void Widen(Vector< int > source, out Vector< long > low, out Vector< long > high)
Definition Vector.cs:586
static Vector< T > BitwiseAnd< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:384
static bool EqualsAll< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:79
static Vector< nint > AsVectorNInt< T >(Vector< T > value)
Definition Vector.cs:486
static Vector< int > GreaterThan(Vector< float > left, Vector< float > right)
Definition Vector.cs:193
static Vector< double > AsVectorDouble< T >(Vector< T > value)
Definition Vector.cs:473
static unsafe Vector< short > Narrow(Vector< int > low, Vector< int > high)
Definition Vector.cs:690
readonly string ToString(string? format, IFormatProvider? formatProvider)
Definition Vector.cs:1059
static T ScalarFloor(T value)
Definition Vector.cs:2192
static T ScalarCeiling(T value)
Definition Vector.cs:2178
static Vector< T > Divide< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:372
static Vector< long > LessThan(Vector< long > left, Vector< long > right)
Definition Vector.cs:120
static bool ScalarGreaterThan(T left, T right)
Definition Vector.cs:1658
static Vector< T > LessThan(Vector< T > left, Vector< T > right)
Definition Vector.cs:1327
static bool ScalarLessThanOrEqual(T left, T right)
Definition Vector.cs:1604
static T ScalarDivide(T left, T right)
Definition Vector.cs:1928
static bool GreaterThanAll< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:220
static Vector< T > Floor(Vector< T > value)
Definition Vector.cs:1485
static Vector< int > Equals(Vector< float > left, Vector< float > right)
Definition Vector.cs:52
static Vector< uint > AsVectorUInt32< T >(Vector< T > value)
Definition Vector.cs:442
static Vector< T > One
Definition Vector.cs:884
static bool operator!=(Vector< T > left, Vector< T > right)
Definition Vector.cs:1218
static Vector< TTo > As< TFrom, TTo >(this Vector< TFrom > vector)
Definition Vector.cs:845
static Vector< int > GreaterThanOrEqual(Vector< int > left, Vector< int > right)
Definition Vector.cs:247
static Vector< T > LessThanOrEqual(Vector< T > left, Vector< T > right)
Definition Vector.cs:1364
static bool LessThanAll< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:126
static unsafe void Widen(Vector< float > source, out Vector< double > low, out Vector< double > high)
Definition Vector.cs:604
static Vector< int > GreaterThanOrEqual(Vector< float > left, Vector< float > right)
Definition Vector.cs:240
static bool operator==(Vector< T > left, Vector< T > right)
Definition Vector.cs:1204
static T ScalarSqrt(T value)
Definition Vector.cs:2124
static Vector< T > LessThan< T >(Vector< T > left, Vector< T > right)
Definition Vector.cs:92
static T GetAllBitsSetValue()
Definition Vector.cs:2036
static Vector< T > operator|(Vector< T > left, Vector< T > right)
Definition Vector.cs:1177
static Vector< T > Abs< T >(Vector< T > value)
Definition Vector.cs:280
static Vector< float > AsVectorSingle< T >(Vector< T > value)
Definition Vector.cs:467
static Vector< T > Abs(Vector< T > value)
Definition Vector.cs:1386
static unsafe Vector< ushort > Narrow(Vector< uint > low, Vector< uint > high)
Definition Vector.cs:640
static unsafe Vector< float > Narrow(Vector< double > low, Vector< double > high)
Definition Vector.cs:722
static Vector< long > LessThanOrEqual(Vector< long > left, Vector< long > right)
Definition Vector.cs:160
static Vector< T > operator^(Vector< T > left, Vector< T > right)
Definition Vector.cs:1187
static string Arg_TypeNotSupported
Definition SR.cs:2066
static string Arg_InsufficientNumberOfElements
Definition SR.cs:2078
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Arg_NullArgumentNullRef
Definition SR.cs:2074
static string Arg_ElementsInSourceIsGreaterThanDestination
Definition SR.cs:2072
static string Arg_ArgumentOutOfRangeException
Definition SR.cs:68
Definition SR.cs:7
static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
static void ThrowArgumentException_DestinationTooShort()
void Add(int value)
Definition HashCode.cs:239
static UIntPtr MaxValue
Definition UIntPtr.cs:31