Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows 2016 build. #5902

Merged
merged 3 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jvm-packages/create_jni.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def normpath(path):
with cd("build"):
if sys.platform == "win32":
# Force x64 build on Windows.
maybe_generator = ' -G"Visual Studio 14 Win64"'
maybe_generator = ' -A x64'
else:
maybe_generator = ""
if sys.platform == "linux":
Expand Down
2 changes: 2 additions & 0 deletions python-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def build_cmake_extension(self):
'%s is used for building Windows distribution.', vs)
break
except subprocess.CalledProcessError:
shutil.rmtree(build_dir)
os.mkdir(build_dir)
continue
else:
gen = '-GNinja' if build_tool == 'ninja' else '-GUnix Makefiles'
Expand Down
14 changes: 7 additions & 7 deletions src/common/charconv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@

#if defined(_MSC_VER)
#include <intrin.h>
namespace {
inline int32_t __builtin_clzll(uint64_t x) {
return static_cast<int32_t>(__lzcnt64(x));
}
} // anonymous namespace
#endif

/*
Expand Down Expand Up @@ -288,8 +283,13 @@ struct RyuPowLogUtils {
return MulShift(m, kFloatPow5Split[i], j); // NOLINT
}

static uint32_t FloorLog2(const uint64_t value) {
return 63 - __builtin_clzll(value);
static uint32_t FloorLog2(const uint32_t value) {
#if defined(_MSC_VER)
unsigned long index; // NOLINT
return _BitScanReverse(&index, value) ? index : 32;
#else
return 31 - __builtin_clz(value);
#endif
}

/*
Expand Down