--- title: Warning C26452 description: "Describes causes of MSVC Code analysis warning C26452, and how to fix the issue." ms.date: 07/15/2020 f1_keywords: ["C26452", "SHIFT_COUNT_NEGATIVE_OR_TOO_BIG"] helpviewer_keywords: ["C26452"] --- # Warning C26452 > Arithmetic overflow: Left shift count is negative or greater than or equal to the operand size, which is undefined behavior (io.3) ## Remarks This warning indicates the shift count is negative, or greater than or equal to the number of bits in the shifted operand. Either case results in undefined behavior. Warning C4293 is a similar check in the Microsoft C++ compiler. Code analysis name: `SHIFT_COUNT_NEGATIVE_OR_TOO_BIG` ## Example ```cpp unsigned __int64 combine(unsigned lo, unsigned hi) { return (hi << 32) | lo; // C26252 here } ``` To correct this warning, use the following code: ```cpp unsigned __int64 combine(unsigned lo, unsigned hi) { return (static_cast(hi) << 32) | lo; // OK } ``` ## See also [ES.102: Use signed types for arithmetic](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-unsigned)