@@ -123,6 +123,7 @@ static void SumVertical(Span<float> target, Span<float> source)
123
123
ref Vector256 < float > sourceVectorRef = ref Unsafe . As < float , Vector256 < float > > ( ref MemoryMarshal . GetReference ( source ) ) ;
124
124
125
125
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
126
+ DebugGuard . IsTrue ( source . Length % 8 == 0 , "source must be multiple of 8" ) ;
126
127
nuint count = source . Vector256Count < float > ( ) ;
127
128
for ( nuint i = 0 ; i < count ; i ++ )
128
129
{
@@ -135,6 +136,7 @@ static void SumVertical(Span<float> target, Span<float> source)
135
136
ref Vector128 < float > sourceVectorRef = ref Unsafe . As < float , Vector128 < float > > ( ref MemoryMarshal . GetReference ( source ) ) ;
136
137
137
138
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
139
+ DebugGuard . IsTrue ( source . Length % 8 == 0 , "source must be multiple of 8" ) ;
138
140
nuint count = source . Vector128Count < float > ( ) ;
139
141
for ( nuint i = 0 ; i < count ; i ++ )
140
142
{
@@ -213,6 +215,7 @@ static void MultiplyToAverage(Span<float> target, float multiplier)
213
215
ref Vector256 < float > targetVectorRef = ref Unsafe . As < float , Vector256 < float > > ( ref MemoryMarshal . GetReference ( target ) ) ;
214
216
215
217
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
218
+ DebugGuard . IsTrue ( target . Length % 8 == 0 , "target must be multiple of 8" ) ;
216
219
nuint count = target . Vector256Count < float > ( ) ;
217
220
Vector256 < float > multiplierVector = Vector256 . Create ( multiplier ) ;
218
221
for ( nuint i = 0 ; i < count ; i ++ )
@@ -225,6 +228,7 @@ static void MultiplyToAverage(Span<float> target, float multiplier)
225
228
ref Vector128 < float > targetVectorRef = ref Unsafe . As < float , Vector128 < float > > ( ref MemoryMarshal . GetReference ( target ) ) ;
226
229
227
230
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
231
+ DebugGuard . IsTrue ( target . Length % 8 == 0 , "target must be multiple of 8" ) ;
228
232
nuint count = target . Vector128Count < float > ( ) ;
229
233
Vector128 < float > multiplierVector = Vector128 . Create ( multiplier ) ;
230
234
for ( nuint i = 0 ; i < count ; i ++ )
0 commit comments