Fix compilation on Windows
There are still a bunch of warning that we should remove.
This commit is contained in:
parent
583e9a8f3c
commit
944b60fb75
|
@ -29,6 +29,13 @@ function(SetPIC Target)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
if (WIN32)
|
||||
# Define NOMINMAX to prevent conflics between std::min/max and the min/max macros in WinDef.h
|
||||
add_definitions(-DNOMINMAX)
|
||||
# Remove compile error where the mock NXT creates too many sections for the old obj format.
|
||||
add_compile_options("/bigobj")
|
||||
endif()
|
||||
|
||||
add_subdirectory(third_party)
|
||||
add_subdirectory(generator)
|
||||
|
||||
|
|
|
@ -210,12 +210,12 @@ class PreprocessingLoader(jinja2.BaseLoader):
|
|||
for line in lines:
|
||||
# The capture in the regex adds one element per block start or end so we divide by two
|
||||
# there is also an extra line chunk corresponding to the line end, so we substract it.
|
||||
numends = (len(self.blockend.split(line)) - 1) / 2
|
||||
numends = (len(self.blockend.split(line)) - 1) // 2
|
||||
indentation_level -= numends
|
||||
|
||||
result.append(self.remove_indentation(line, indentation_level))
|
||||
|
||||
numstarts = (len(self.blockstart.split(line)) - 1) / 2
|
||||
numstarts = (len(self.blockstart.split(line)) - 1) // 2
|
||||
indentation_level += numstarts
|
||||
|
||||
return '\n'.join(result)
|
||||
|
@ -456,6 +456,7 @@ def main():
|
|||
[os.path.abspath(args.json[0])] +
|
||||
[os.path.realpath(__file__)]
|
||||
)
|
||||
dependencies = [dependency.replace('\\', '/') for dependency in dependencies]
|
||||
sys.stdout.write(output_separator.join(dependencies))
|
||||
return 0
|
||||
|
||||
|
@ -463,6 +464,7 @@ def main():
|
|||
outputs = set(
|
||||
[os.path.abspath(args.output_dir + os.path.sep + render.output) for render in renders]
|
||||
)
|
||||
outputs = [output.replace('\\', '/') for output in outputs]
|
||||
sys.stdout.write(output_separator.join(outputs))
|
||||
return 0
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <nxt/nxt.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// An abstract base class representing a proc table so that API calls can be mocked. Most API calls
|
||||
// are directly represented by a delete virtual method but others need minimal state tracking to be
|
||||
// useful as mocks.
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "Math.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstdlib>
|
||||
|
|
|
@ -14,23 +14,34 @@
|
|||
|
||||
#include "Math.h"
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
#include "Forward.h"
|
||||
|
||||
namespace backend {
|
||||
|
||||
unsigned long ScanForward(unsigned long bits) {
|
||||
uint32_t ScanForward(uint32_t bits) {
|
||||
ASSERT(bits != 0);
|
||||
// TODO(cwallez@chromium.org): handle non-posix platforms
|
||||
// unsigned long firstBitIndex = 0ul;
|
||||
// unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
||||
// ASSERT(ret != 0);
|
||||
// return firstBitIndex;
|
||||
return static_cast<unsigned long>(__builtin_ctzl(bits));
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
unsigned long firstBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
||||
ASSERT(ret != 0);
|
||||
return firstBitIndex;
|
||||
#else
|
||||
return static_cast<unsigned long>(__builtin_ctz(bits));
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t Log2(uint32_t value) {
|
||||
ASSERT(value != 0);
|
||||
return 31 - __builtin_clz(value);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
unsigned long firstBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanReverse(&firstBitIndex, value);
|
||||
ASSERT(ret != 0);
|
||||
return firstBitIndex;
|
||||
#else
|
||||
return 31 - __builtin_clz(value);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsPowerOfTwo(size_t n) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
namespace backend {
|
||||
|
||||
// The following are not valid for 0
|
||||
unsigned long ScanForward(unsigned long bits);
|
||||
uint32_t ScanForward(uint32_t bits);
|
||||
uint32_t Log2(uint32_t value);
|
||||
bool IsPowerOfTwo(size_t n);
|
||||
|
||||
|
|
Loading…
Reference in New Issue