Browse Source
Update src/ImageSharp/Common/Helpers/Numerics.cs
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
pull/2793/head
James Jackson-South
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
6 deletions
-
src/ImageSharp/Common/Helpers/Numerics.cs
|
|
|
@ -1166,13 +1166,9 @@ internal static class Numerics |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ref float startRef = ref MemoryMarshal.GetReference(span); |
|
|
|
ref float endRef = ref Unsafe.Add(ref startRef, span.Length); |
|
|
|
|
|
|
|
while (Unsafe.IsAddressLessThan(ref startRef, ref endRef)) |
|
|
|
for (int i = 0; i < span.Length; i++) |
|
|
|
{ |
|
|
|
startRef /= sum; |
|
|
|
startRef = ref Unsafe.Add(ref startRef, (nuint)1); |
|
|
|
span[i] /= sum; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|