From 0c0cc9ef81dfe455edd76e43649ba6cef877da57 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 20 Sep 2021 23:59:26 -0600 Subject: [PATCH] bspfile: fix OverflowsUint16 --- common/bspfile.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/bspfile.cc b/common/bspfile.cc index e04e0cd1..c77b1954 100644 --- a/common/bspfile.cc +++ b/common/bspfile.cc @@ -988,14 +988,17 @@ OverflowsInt16(int32_t input) { return false; } -static bool +static constexpr bool OverflowsUint16(uint32_t input) { - if (input > INT16_MAX) { + if (input > UINT16_MAX) { return true; } return false; } +static_assert(!OverflowsUint16(65535)); +static_assert( OverflowsUint16(65536)); + static bool MBSPto29_Leafs_Validate(const mleaf_t *mleafs, int numleafs) { const mleaf_t *mleaf = mleafs;