@@ -132,7 +132,7 @@ public unsafe void LoadFrom(Span<int> source)
132132 /// </summary>
133133 /// <param name="dest">Destination</param>
134134 [ MethodImpl ( InliningOptions . ShortMethod ) ]
135- public unsafe void ScaledCopyTo ( float [ ] dest )
135+ public readonly void ScaledCopyTo ( float [ ] dest )
136136 {
137137 DebugGuard . MustBeGreaterThanOrEqualTo ( dest . Length , Size , "dest is too small" ) ;
138138
@@ -193,7 +193,7 @@ public void MultiplyInPlace(float value)
193193 /// </summary>
194194 /// <param name="other">The other block.</param>
195195 [ MethodImpl ( InliningOptions . ShortMethod ) ]
196- public unsafe void MultiplyInPlace ( ref Block8x8F other )
196+ public void MultiplyInPlace ( ref Block8x8F other )
197197 {
198198 if ( Vector256 . IsHardwareAccelerated )
199199 {
@@ -324,62 +324,43 @@ public Block8x8 RoundAsInt16Block()
324324 }
325325
326326 /// <summary>
327- /// Level shift by +maximum/2, clip to [0..maximum], and round all the values in the block.
327+ /// Level shift by +maximum/2, clip to [0, maximum]
328328 /// </summary>
329- /// <param name="maximum">The maximum value.</param>
330- public void NormalizeColorsAndRoundInPlace ( float maximum )
329+ /// <param name="maximum">The maximum value to normalize to .</param>
330+ public void NormalizeColorsInPlace ( float maximum )
331331 {
332332 if ( Vector256 . IsHardwareAccelerated )
333333 {
334- this . NormalizeColorsAndRoundInPlaceVector256 ( maximum ) ;
334+ this . NormalizeColorsInPlaceVector256 ( maximum ) ;
335+ return ;
335336 }
336337 else if ( Vector128 . IsHardwareAccelerated )
337338 {
338- this . NormalizeColorsAndRoundInPlaceVector128 ( maximum ) ;
339+ this . NormalizeColorsInPlaceVector128 ( maximum ) ;
340+ return ;
339341 }
340342 else
341343 {
342- this . NormalizeColorsInPlace ( maximum ) ;
343- this . RoundInPlace ( ) ;
344- }
345- }
346-
347- /// <summary>
348- /// Level shift by +maximum/2, clip to [0, maximum]
349- /// </summary>
350- /// <param name="maximum">The maximum value to normalize to.</param>
351- public void NormalizeColorsInPlace ( float maximum )
352- {
353- Vector4 min = Vector4 . Zero ;
354- Vector4 max = new ( maximum ) ;
355- Vector4 off = new ( MathF . Ceiling ( maximum * 0.5F ) ) ;
356-
357- this . V0L = Vector4 . Clamp ( this . V0L + off , min , max ) ;
358- this . V0R = Vector4 . Clamp ( this . V0R + off , min , max ) ;
359- this . V1L = Vector4 . Clamp ( this . V1L + off , min , max ) ;
360- this . V1R = Vector4 . Clamp ( this . V1R + off , min , max ) ;
361- this . V2L = Vector4 . Clamp ( this . V2L + off , min , max ) ;
362- this . V2R = Vector4 . Clamp ( this . V2R + off , min , max ) ;
363- this . V3L = Vector4 . Clamp ( this . V3L + off , min , max ) ;
364- this . V3R = Vector4 . Clamp ( this . V3R + off , min , max ) ;
365- this . V4L = Vector4 . Clamp ( this . V4L + off , min , max ) ;
366- this . V4R = Vector4 . Clamp ( this . V4R + off , min , max ) ;
367- this . V5L = Vector4 . Clamp ( this . V5L + off , min , max ) ;
368- this . V5R = Vector4 . Clamp ( this . V5R + off , min , max ) ;
369- this . V6L = Vector4 . Clamp ( this . V6L + off , min , max ) ;
370- this . V6R = Vector4 . Clamp ( this . V6R + off , min , max ) ;
371- this . V7L = Vector4 . Clamp ( this . V7L + off , min , max ) ;
372- this . V7R = Vector4 . Clamp ( this . V7R + off , min , max ) ;
373- }
374-
375- /// <summary>
376- /// Rounds all values in the block.
377- /// </summary>
378- public void RoundInPlace ( )
379- {
380- for ( int i = 0 ; i < Size ; i ++ )
381- {
382- this [ i ] = MathF . Round ( this [ i ] ) ;
344+ Vector4 min = Vector4 . Zero ;
345+ Vector4 max = new ( maximum ) ;
346+ Vector4 off = new ( MathF . Ceiling ( maximum * 0.5F ) ) ;
347+
348+ this . V0L = Vector4 . Clamp ( this . V0L + off , min , max ) ;
349+ this . V0R = Vector4 . Clamp ( this . V0R + off , min , max ) ;
350+ this . V1L = Vector4 . Clamp ( this . V1L + off , min , max ) ;
351+ this . V1R = Vector4 . Clamp ( this . V1R + off , min , max ) ;
352+ this . V2L = Vector4 . Clamp ( this . V2L + off , min , max ) ;
353+ this . V2R = Vector4 . Clamp ( this . V2R + off , min , max ) ;
354+ this . V3L = Vector4 . Clamp ( this . V3L + off , min , max ) ;
355+ this . V3R = Vector4 . Clamp ( this . V3R + off , min , max ) ;
356+ this . V4L = Vector4 . Clamp ( this . V4L + off , min , max ) ;
357+ this . V4R = Vector4 . Clamp ( this . V4R + off , min , max ) ;
358+ this . V5L = Vector4 . Clamp ( this . V5L + off , min , max ) ;
359+ this . V5R = Vector4 . Clamp ( this . V5R + off , min , max ) ;
360+ this . V6L = Vector4 . Clamp ( this . V6L + off , min , max ) ;
361+ this . V6R = Vector4 . Clamp ( this . V6R + off , min , max ) ;
362+ this . V7L = Vector4 . Clamp ( this . V7L + off , min , max ) ;
363+ this . V7R = Vector4 . Clamp ( this . V7R + off , min , max ) ;
383364 }
384365 }
385366
@@ -533,7 +514,7 @@ public bool EqualsToScalar(int value)
533514 }
534515
535516 /// <inheritdoc />
536- public bool Equals ( Block8x8F other )
517+ public readonly bool Equals ( Block8x8F other )
537518 => this . V0L == other . V0L
538519 && this . V0R == other . V0R
539520 && this . V1L == other . V1L
0 commit comments