Skip to content

Commit 27437bc

Browse files
am11xzyfer
authored andcommitted
Disable FMA3 when compiling with VS2013 (#2308)
* Disable FMA3 when compiling with VS2013 * Add Win64 job to AppVeyor CI
1 parent 1849092 commit 27437bc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

appveyor.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ environment:
77
matrix:
88
- Compiler: msvc
99
Config: Release
10+
Platform: Win32
1011
- Compiler: msvc
1112
Config: Debug
13+
Platform: Win32
14+
- Compiler: msvc
15+
Config: Release
16+
Platform: Win64
1217
- Compiler: mingw
1318
Build: static
1419
- Compiler: mingw
@@ -38,7 +43,7 @@ build_script:
3843
if ($env:Compiler -eq "mingw") {
3944
mingw32-make -j4 sassc
4045
} else {
41-
msbuild /m:4 /p:Configuration=$env:Config sassc\win\sassc.sln
46+
msbuild /m:4 /p:"Configuration=$env:Config;Platform=$env:Platform" sassc\win\sassc.sln
4247
}
4348
4449
# print the branding art
@@ -84,4 +89,3 @@ test_script:
8489
} else {
8590
echo "Success!"
8691
}
87-

src/util.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99

1010
#include <cmath>
1111
#include <stdint.h>
12+
#if defined(_MSC_VER) && _MSC_VER >= 1800 && _MSC_VER < 1900 && defined(_M_X64)
13+
#include <mutex>
14+
#endif
1215

1316
namespace Sass {
1417

1518
double round(double val, size_t precision)
1619
{
20+
// Disable FMA3-optimized implementation when compiling with VS2013 for x64 targets
21+
// See https://github.com/sass/node-sass/issues/1854 for details
22+
// FIXME: Remove this workaround when we switch to VS2015+
23+
#if defined(_MSC_VER) && _MSC_VER >= 1800 && _MSC_VER < 1900 && defined(_M_X64)
24+
static std::once_flag flag;
25+
std::call_once(flag, []() { _set_FMA3_enable(0); });
26+
#endif
27+
1728
// https://github.com/sass/sass/commit/4e3e1d5684cc29073a507578fc977434ff488c93
1829
if (fmod(val, 1) - 0.5 > - std::pow(0.1, precision + 1)) return std::ceil(val);
1930
else if (fmod(val, 1) - 0.5 > std::pow(0.1, precision)) return std::floor(val);

0 commit comments

Comments
 (0)