Skip to content

Commit

Permalink
Ensure JIT_Dbl2ULng correctly handles NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed May 27, 2022
1 parent 5d5fb3a commit 3298345
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,14 @@ HCIMPL1_V(UINT64, JIT_Dbl2ULng, double val)
if (val < two63) {
ret = FastDbl2Lng(val);
}
else {
else if (!_isnan(val)) {
// subtract 0x8000000000000000, do the convert then add it back again
ret = FastDbl2Lng(val - two63) + I64(0x8000000000000000);
}
else {
// specially handle NaN otherwise we return (Int64.MaxValue + 1)
ret = 0;
}
return ret;
}
HCIMPLEND
Expand Down

0 comments on commit 3298345

Please sign in to comment.