diff --git a/src/ImageSharp/Common/Helpers/BitOperations.cs b/src/ImageSharp/Common/Helpers/BitOperations.cs
deleted file mode 100644
index af56efd56..000000000
--- a/src/ImageSharp/Common/Helpers/BitOperations.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) Six Labors.
-// Licensed under the Apache License, Version 2.0.
-
-using System.Runtime.CompilerServices;
-
-#if !NETCOREAPP3_1_OR_GREATER
-namespace SixLabors.ImageSharp.Common.Helpers
-{
- ///
- /// Polyfill for System.Numerics.BitOperations class, introduced in .NET Core 3.0.
- ///
- ///
- public static class BitOperations
- {
- ///
- /// Rotates the specified value left by the specified number of bits.
- ///
- /// The value to rotate.
- /// The number of bits to roate with.
- /// The rotated value.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint RotateLeft(uint value, int offset)
- => (value << offset) | (value >> (32 - offset));
- }
-}
-#endif
diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs
index fa0af823d..df81c39e7 100644
--- a/src/ImageSharp/Common/Helpers/Numerics.cs
+++ b/src/ImageSharp/Common/Helpers/Numerics.cs
@@ -907,5 +907,33 @@ namespace SixLabors.ImageSharp
/// Divisor value.
/// Ceiled division result.
public static uint DivideCeil(uint value, uint divisor) => (value + divisor - 1) / divisor;
+
+ ///
+ /// Rotates the specified value left by the specified number of bits.
+ ///
+ /// The value to rotate.
+ /// The number of bits to roate with.
+ /// The rotated value.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static uint RotateLeft(uint value, int offset)
+ {
+#if SUPPORTS_BITOPERATIONS
+ return BitOperations.RotateLeft(value, offset);
+#else
+ return RotateLeftSoftwareFallback(value, offset);
+#endif
+ }
+
+#if !SUPPORTS_BITOPERATIONS
+ ///
+ /// Rotates the specified value left by the specified number of bits.
+ ///
+ /// The value to rotate.
+ /// The number of bits to roate with.
+ /// The rotated value.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static uint RotateLeftSoftwareFallback(uint value, int offset)
+ => (value << offset) | (value >> (32 - offset));
+#endif
}
}
diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
index 1922c787c..da60928d3 100644
--- a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
+++ b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
@@ -190,7 +190,7 @@ namespace SixLabors.ImageSharp
// tmp1 + tmp3 = [W X Y Z]
uint tmp1 = packed & 0xFF00FF00;
uint tmp2 = packed & 0x00FF00FF;
- uint tmp3 = BitOperations.RotateLeft(tmp2, 16);
+ uint tmp3 = Numerics.RotateLeft(tmp2, 16);
Unsafe.Add(ref dBase, i) = tmp1 + tmp3;
}
@@ -223,7 +223,7 @@ namespace SixLabors.ImageSharp
// tmp1 + tmp3 = [Y Z W X]
uint tmp1 = packed & 0x00FF00FF;
uint tmp2 = packed & 0xFF00FF00;
- uint tmp3 = BitOperations.RotateLeft(tmp2, 16);
+ uint tmp3 = Numerics.RotateLeft(tmp2, 16);
Unsafe.Add(ref dBase, i) = tmp1 + tmp3;
}