@@ -222,7 +222,7 @@ private static void Shuffle4(
222222 ref Vector256 < float > destBase =
223223 ref Unsafe . As < float , Vector256 < float > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
224224
225- nint n = ( nint ) ( uint ) ( dest . Length / Vector256 < float > . Count ) ;
225+ nint n = ( nint ) dest . Vector256Count < float > ( ) ;
226226 nint m = Numerics . Modulo4 ( n ) ;
227227 nint u = n - m ;
228228
@@ -392,7 +392,7 @@ private static void Shuffle3(
392392 ref Vector128 < byte > destBase =
393393 ref Unsafe . As < byte , Vector128 < byte > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
394394
395- nuint n = ( uint ) source . Length / ( uint ) Vector128 < byte > . Count ;
395+ nuint n = source . Vector128Count < byte > ( ) ;
396396
397397 for ( nuint i = 0 ; i < n ; i += 3 )
398398 {
@@ -455,7 +455,7 @@ private static void Pad3Shuffle4(
455455 ref Vector128 < byte > destBase =
456456 ref Unsafe . As < byte , Vector128 < byte > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
457457
458- nuint n = ( uint ) source . Length / ( uint ) Vector128 < byte > . Count ;
458+ nuint n = source . Vector128Count < byte > ( ) ;
459459
460460 for ( nuint i = 0 , j = 0 ; i < n ; i += 3 , j += 4 )
461461 {
@@ -499,7 +499,7 @@ private static void Shuffle4Slice3(
499499 ref Vector128 < byte > destBase =
500500 ref Unsafe . As < byte , Vector128 < byte > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
501501
502- nuint n = ( uint ) source . Length / ( uint ) Vector128 < byte > . Count ;
502+ nuint n = source . Vector128Count < byte > ( ) ;
503503
504504 for ( nuint i = 0 , j = 0 ; i < n ; i += 4 , j += 3 )
505505 {
@@ -679,7 +679,7 @@ internal static unsafe void ByteToNormalizedFloat(
679679 {
680680 VerifySpanInput ( source , dest , Vector256 < byte > . Count ) ;
681681
682- nuint n = ( uint ) dest . Length / ( uint ) Vector256 < byte > . Count ;
682+ nuint n = dest . Vector256Count < byte > ( ) ;
683683
684684 ref Vector256 < float > destBase =
685685 ref Unsafe . As < float , Vector256 < float > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
@@ -712,7 +712,7 @@ internal static unsafe void ByteToNormalizedFloat(
712712 // Sse
713713 VerifySpanInput ( source , dest , Vector128 < byte > . Count ) ;
714714
715- nuint n = ( uint ) dest . Length / ( uint ) Vector128 < byte > . Count ;
715+ nuint n = dest . Vector128Count < byte > ( ) ;
716716
717717 ref Vector128 < float > destBase =
718718 ref Unsafe . As < float , Vector128 < float > > ( ref MemoryMarshal . GetReference ( dest ) ) ;
@@ -811,7 +811,7 @@ internal static void NormalizedFloatToByteSaturate(
811811 {
812812 VerifySpanInput ( source , dest , Vector256 < byte > . Count ) ;
813813
814- nuint n = ( uint ) dest . Length / ( uint ) Vector256 < byte > . Count ;
814+ nuint n = dest . Vector256Count < byte > ( ) ;
815815
816816 ref Vector256 < float > sourceBase =
817817 ref Unsafe . As < float , Vector256 < float > > ( ref MemoryMarshal . GetReference ( source ) ) ;
@@ -850,7 +850,7 @@ internal static void NormalizedFloatToByteSaturate(
850850 // Sse
851851 VerifySpanInput ( source , dest , Vector128 < byte > . Count ) ;
852852
853- nuint n = ( uint ) dest . Length / ( uint ) Vector128 < byte > . Count ;
853+ nuint n = dest . Vector128Count < byte > ( ) ;
854854
855855 ref Vector128 < float > sourceBase =
856856 ref Unsafe . As < float , Vector128 < float > > ( ref MemoryMarshal . GetReference ( source ) ) ;
@@ -893,7 +893,7 @@ internal static void PackFromRgbPlanesAvx2Reduce(
893893 ref Vector256 < byte > bBase = ref Unsafe . As < byte , Vector256 < byte > > ( ref MemoryMarshal . GetReference ( blueChannel ) ) ;
894894 ref byte dBase = ref Unsafe . As < Rgb24 , byte > ( ref MemoryMarshal . GetReference ( destination ) ) ;
895895
896- nuint count = ( uint ) redChannel . Length / ( uint ) Vector256 < byte > . Count ;
896+ nuint count = redChannel . Vector256Count < byte > ( ) ;
897897
898898 ref byte control1Bytes = ref MemoryMarshal . GetReference ( PermuteMaskEvenOdd8x32 ) ;
899899 Vector256 < uint > control1 = Unsafe . As < byte , Vector256 < uint > > ( ref control1Bytes ) ;
@@ -965,7 +965,7 @@ internal static void PackFromRgbPlanesAvx2Reduce(
965965 ref Vector256 < byte > bBase = ref Unsafe . As < byte , Vector256 < byte > > ( ref MemoryMarshal . GetReference ( blueChannel ) ) ;
966966 ref Vector256 < byte > dBase = ref Unsafe . As < Rgba32 , Vector256 < byte > > ( ref MemoryMarshal . GetReference ( destination ) ) ;
967967
968- nuint count = ( uint ) redChannel . Length / ( uint ) Vector256 < byte > . Count ;
968+ nuint count = redChannel . Vector256Count < byte > ( ) ;
969969 ref byte control1Bytes = ref MemoryMarshal . GetReference ( PermuteMaskEvenOdd8x32 ) ;
970970 Vector256 < uint > control1 = Unsafe . As < byte , Vector256 < uint > > ( ref control1Bytes ) ;
971971 var a = Vector256 . Create ( ( byte ) 255 ) ;
0 commit comments