Fix MSVC builder failure with NextPowerOfTwo.
Define behavior of n=0 when compiling on MSVC. BUG=dawn:27 Change-Id: If9d454833f5b3d8f0183eba2bc5a54f9ca6e56a2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9440 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
9d2ccaf65c
commit
506ce9bba4
|
@ -59,11 +59,11 @@ uint32_t Log2(uint64_t value) {
|
|||
#endif
|
||||
}
|
||||
|
||||
uint64_t NextPowerOfTwo(uint64_t x) {
|
||||
uint64_t NextPowerOfTwo(uint64_t n) {
|
||||
#if defined(DAWN_COMPILER_MSVC)
|
||||
return x == 1 ? 1 : 1ull << (64 - __lzcnt64(x - 1));
|
||||
return n <= 1 ? 1 : 1ull << (64 - __lzcnt64(n - 1));
|
||||
#else
|
||||
return x == 1 ? 1 : 1ull << (64 - __builtin_clzll(x - 1));
|
||||
return n == 1 ? 1 : 1ull << (64 - __builtin_clzll(n - 1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ uint32_t Log2(uint32_t value);
|
|||
uint32_t Log2(uint64_t value);
|
||||
bool IsPowerOfTwo(size_t n);
|
||||
|
||||
uint64_t NextPowerOfTwo(uint64_t x);
|
||||
uint64_t NextPowerOfTwo(uint64_t n);
|
||||
bool IsPtrAligned(const void* ptr, size_t alignment);
|
||||
void* AlignVoidPtr(void* ptr, size_t alignment);
|
||||
bool IsAligned(uint32_t value, size_t alignment);
|
||||
|
|
Loading…
Reference in New Issue