Prevent kMaxHeapSize overflow on 32-bit debug builds.

Uses uint64_t instead of size_t in isPowerOfTwo checks.

BUG=dawn:27

Change-Id: If8bcdcd855d10fd2dc1f42fa18e3defab13a76b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12500
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Bryan Bernhart 2019-10-21 09:23:09 +00:00 committed by Commit Bot service account
parent 5c2f5f3961
commit 8d00f5db8f
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ uint64_t NextPowerOfTwo(uint64_t n) {
#endif
}
bool IsPowerOfTwo(size_t n) {
bool IsPowerOfTwo(uint64_t n) {
ASSERT(n != 0);
return (n & (n - 1)) == 0;
}

View File

@ -26,7 +26,7 @@
uint32_t ScanForward(uint32_t bits);
uint32_t Log2(uint32_t value);
uint32_t Log2(uint64_t value);
bool IsPowerOfTwo(size_t n);
bool IsPowerOfTwo(uint64_t n);
uint64_t NextPowerOfTwo(uint64_t n);
bool IsPtrAligned(const void* ptr, size_t alignment);