diff options
author | Justin Lebar <jlebar@google.com> | 2016-07-16 00:59:41 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-07-16 00:59:41 +0000 |
commit | 8d56f47cfee9bde51bc5ed985c74b3e87185e2d0 (patch) | |
tree | 48f90940316136c17b986c52ccab8bc4eaecc022 /llvm/unittests/Support/MathExtrasTest.cpp | |
parent | 2a7248f06b10e966daa1077e707122af910a3067 (diff) | |
download | bcm5719-llvm-8d56f47cfee9bde51bc5ed985c74b3e87185e2d0.tar.gz bcm5719-llvm-8d56f47cfee9bde51bc5ed985c74b3e87185e2d0.zip |
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
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
-rw-r--r-- | llvm/unittests/Support/MathExtrasTest.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp index 04e16628e64..ef46311665d 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)); } |