Skip to content

Commit 64998e4

Browse files
jaykrellJay Krell
authored andcommitted
Use intrinsic to get double as int, instead of taking address which challenges the compiler.
1 parent c2168c6 commit 64998e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Runtime/Library/JavascriptNumber.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ namespace Js
147147

148148
inline Var JavascriptNumber::ToVar(double value)
149149
{
150+
#if defined(_MSC_VER) && defined(_AMD64_)
151+
uint64 val = _mm_cvtsi128_si64(_mm_castpd_si128(_mm_set_sd(value)));
152+
#else
150153
uint64 val = *(uint64*)&value;
154+
#endif
151155
AssertMsg(!IsNan(value) || ToSpecial(value) == k_NegativeNan || ToSpecial(value) == 0x7FF8000000000000ull, "We should only produce a NaN with this value");
152156
return reinterpret_cast<Var>(val ^ FloatTag_Value);
153157
}

0 commit comments

Comments
 (0)