[llvm] r211521 - Cleanup r211507

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jun 23 11:08:58 PDT 2014


Author: dexonsmith
Date: Mon Jun 23 13:08:58 2014
New Revision: 211521

URL: http://llvm.org/viewvc/llvm-project?rev=211521&view=rev
Log:
Cleanup r211507

Modified:
    llvm/trunk/include/llvm/Support/ScaledNumber.h
    llvm/trunk/unittests/Support/ScaledNumberTest.cpp

Modified: llvm/trunk/include/llvm/Support/ScaledNumber.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ScaledNumber.h?rev=211521&r1=211520&r2=211521&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ScaledNumber.h (original)
+++ llvm/trunk/include/llvm/Support/ScaledNumber.h Mon Jun 23 13:08:58 2014
@@ -242,6 +242,8 @@ int compareImpl(uint64_t L, uint64_t R,
 /// for greater than.
 template <class DigitsT>
 int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale) {
+  static_assert(!std::numeric_limits<DigitsT>::is_signed, "expected unsigned");
+
   // Check for zero.
   if (!LDigits)
     return RDigits ? -1 : 0;

Modified: llvm/trunk/unittests/Support/ScaledNumberTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ScaledNumberTest.cpp?rev=211521&r1=211520&r2=211521&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ScaledNumberTest.cpp (original)
+++ llvm/trunk/unittests/Support/ScaledNumberTest.cpp Mon Jun 23 13:08:58 2014
@@ -285,7 +285,7 @@ TEST(ScaledNumberHelpersTest, getLgCeili
   EXPECT_EQ(INT32_MIN, getLgCeiling(UINT64_C(0), 1));
 }
 
-TEST(ScaledNumberHelpersTest, Compare) {
+TEST(ScaledNumberHelpersTest, compare) {
   EXPECT_EQ(0, compare(UINT32_C(0), 0, UINT32_C(0), 1));
   EXPECT_EQ(0, compare(UINT32_C(0), 0, UINT32_C(0), -10));
   EXPECT_EQ(0, compare(UINT32_C(0), 0, UINT32_C(0), 20));





More information about the llvm-commits mailing list