22// Licensed under the Apache License, Version 2.0.
33// https://github.com/SixLabors/ImageSharp/blob/master/src/ImageSharp/Formats/Png/Zlib/Adler32.cs
44
5-
6- #if NETCOREAPP
75using System ;
8-
9- #if ! NETCOREAPP2_1
6+ #if ! NET45 && ! NET461 && ! NET471 && ! NETSTANDARD1_3 && ! NETSTANDARD2_0 && ! NETSTANDARD2_1 && ! NETCOREAPP2_1
107using System . Runtime . Intrinsics ;
118using System . Runtime . Intrinsics . X86 ;
129#endif
1310
14- #endif
15-
1611#pragma warning disable IDE0007 // Use implicit type
1712
1813namespace MySqlConnector . Utilities
@@ -34,7 +29,7 @@ internal static class Adler32
3429 // NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
3530 private const uint NMAX = 5552 ;
3631
37- #if NETCOREAPP && ! NETCOREAPP2_1
32+ #if ! NET45 && ! NET461 && ! NET471 && ! NETSTANDARD1_3 && ! NETSTANDARD2_0 && ! NETSTANDARD2_1 && ! NETCOREAPP2_1
3833 private const int MinBufferSize = 64 ;
3934
4035 // The C# compiler emits this as a compile-time constant embedded in the PE file.
@@ -52,18 +47,14 @@ internal static class Adler32
5247 /// <param name="offset"></param>
5348 /// <param name="length"></param>
5449 /// <returns>The <see cref="uint"/>.</returns>
55- #if NETCOREAPP
5650 public static uint Calculate ( ReadOnlySpan < byte > buffer , uint offset , uint length )
57- #else
58- public static uint Calculate ( byte [ ] buffer , uint offset , uint length )
59- #endif
6051 {
6152 if ( buffer . Length == 0 )
6253 {
6354 return SeedValue ;
6455 }
6556
66- #if NETCOREAPP && ! NETCOREAPP2_1
57+ #if ! NET45 && ! NET461 && ! NET471 && ! NETSTANDARD1_3 && ! NETSTANDARD2_0 && ! NETSTANDARD2_1 && ! NETCOREAPP2_1
6758 if ( Ssse3 . IsSupported && buffer . Length >= MinBufferSize )
6859 {
6960 return CalculateSse ( buffer , offset , length ) ;
@@ -74,7 +65,7 @@ public static uint Calculate(byte[] buffer, uint offset, uint length)
7465 }
7566
7667
77- #if NETCOREAPP && ! NETCOREAPP2_1
68+ #if ! NET45 && ! NET461 && ! NET471 && ! NETSTANDARD1_3 && ! NETSTANDARD2_0 && ! NETSTANDARD2_1 && ! NETCOREAPP2_1
7869 // Based on https://github.com/chromium/chromium/blob/master/third_party/zlib/adler32_simd.c
7970 private static unsafe uint CalculateSse ( ReadOnlySpan < byte > buffer , uint offset , uint length )
8071 {
@@ -202,11 +193,7 @@ private static unsafe uint CalculateSse(ReadOnlySpan<byte> buffer, uint offset,
202193 }
203194#endif
204195
205- #if NETCOREAPP
206196 private static unsafe uint CalculateScalar ( ReadOnlySpan < byte > buffer , uint offset , uint length )
207- #else
208- private static unsafe uint CalculateScalar ( byte [ ] buffer , uint offset , uint length )
209- #endif
210197 {
211198 uint s1 = SeedValue & 0xFFFF ;
212199 uint s2 = ( SeedValue >> 16 ) & 0xFFFF ;
0 commit comments