提交 c6a0c459 编写于 作者: V VSadov 提交者: Andy Gocke

Change detection of double 0.0 to use BitConverter.DoubleToInt64Bits

Underneath BitConverter just casts 64bit double to a 64bit int with the same bit pattern, making it a simpler operation.

(cherry picked from commit 4d439ab7)
上级 d4a181fa
......@@ -232,7 +232,7 @@ public static ConstantValue Create(bool value)
public static ConstantValue Create(float value)
{
if (value == 0 && 1 / value > 0)
if (BitConverter.DoubleToInt64Bits(value) == 0)
{
return ConstantValueDefault.Single;
}
......@@ -246,7 +246,7 @@ public static ConstantValue Create(float value)
public static ConstantValue CreateSingle(double value)
{
if (value == 0 && 1 / value > 0)
if (BitConverter.DoubleToInt64Bits(value) == 0)
{
return ConstantValueDefault.Single;
}
......@@ -260,7 +260,7 @@ public static ConstantValue CreateSingle(double value)
public static ConstantValue Create(double value)
{
if (value == 0 && 1 / value > 0)
if (BitConverter.DoubleToInt64Bits(value) == 0)
{
return ConstantValueDefault.Double;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册