Skip to content

Commit

Permalink
Fix Windows 2016 build. (#5902)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis authored Jul 17, 2020
1 parent 71b0528 commit 6c0c872
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
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

0 comments on commit 6c0c872

Please sign in to comment.