Avoid i386 compile error related to comparison

Adds casts to uint64_t so that a comparison between size_t and the
largest possible uint32_t value does not lead to a tautological warning
when building for i386.

Fixes tint:1162

Change-Id: Ib18140805d443d51bb7e48c9e345b21b9d5651fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63440
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Alastair Donaldson 2021-09-03 12:31:30 +00:00 committed by Tint LUCI CQ
parent 5dc0ea7cce
commit 937a658b58
1 changed files with 2 additions and 1 deletions

View File

@ -321,7 +321,8 @@ uint32_t Inspector::GetStorageSize(const std::string& entry_point) {
} }
} }
if (size > std::numeric_limits<uint32_t>::max()) { if (static_cast<uint64_t>(size) >
static_cast<uint64_t>(std::numeric_limits<uint32_t>::max())) {
return std::numeric_limits<uint32_t>::max(); return std::numeric_limits<uint32_t>::max();
} }
return static_cast<uint32_t>(size); return static_cast<uint32_t>(size);