From 8d56f47cfee9bde51bc5ed985c74b3e87185e2d0 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Sat, 16 Jul 2016 00:59:41 +0000 Subject: Don't do uint64_t(1) << 64 in maxUIntN. Summary: This shift is undefined behavior (and, as compiled by clang, gives the wrong answer for maxUIntN(64)). Reviewers: mkuper Subscribers: llvm-commits, jroelofs, rsmith Differential Revision: https://reviews.llvm.org/D22430 llvm-svn: 275656 --- llvm/unittests/Support/MathExtrasTest.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/unittests/Support/MathExtrasTest.cpp') diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp index 04e1662..ef46311 100644 --- a/llvm/unittests/Support/MathExtrasTest.cpp +++ b/llvm/unittests/Support/MathExtrasTest.cpp @@ -131,6 +131,7 @@ TEST(MathExtras, minIntN) { TEST(MathExtras, maxUIntN) { EXPECT_EQ(0xffffULL, maxUIntN(16)); EXPECT_EQ(0xffffffffULL, maxUIntN(32)); + EXPECT_EQ(0xffffffffffffffffULL, maxUIntN(64)); EXPECT_EQ(1ULL, maxUIntN(1)); EXPECT_EQ(0x0fULL, maxUIntN(4)); } -- cgit v1.1