// We use this explicit definition to avoid the confusion between 0.0 and -0.0.
internal const double NegativeZero = -0.0;
- [NonVersionable]
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static int GetExponent(double d)
- {
- var bits = BitConverter.DoubleToInt64Bits(d);
- return (int)((bits >> 52) & 0x7FF);
- }
-
- [NonVersionable]
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static long GetMantissa(double d)
- {
- var bits = BitConverter.DoubleToInt64Bits(d);
- return (bits & 0xFFFFFFFFFFFFF);
- }
-
/// <summary>Determines whether the specified value is finite (zero, subnormal, or normal).</summary>
[NonVersionable]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
}
- [StructLayout(LayoutKind.Sequential, Size = (MaxBlockCount * sizeof(uint)))]
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct BlocksBuffer
{
+ private fixed uint _blocks[MaxBlockCount];
+
public ref uint this[int index]
{
get
private static long ExtractFractionAndBiasedExponent(double value, out int exponent)
{
- long fraction = double.GetMantissa(value);
- exponent = double.GetExponent(value);
+ var bits = BitConverter.DoubleToInt64Bits(value);
+ long fraction = (bits & 0xFFFFFFFFFFFFF);
+ exponent = (int)((bits >> 52) & 0x7FF);
if (exponent != 0)
{