[libc-commits] [libc] 7f68675 - [libc] Fix compilation error on targets without 128-bit int types (#97039)

via libc-commits libc-commits at lists.llvm.org
Fri Jun 28 04:35:35 PDT 2024


Author: OverMighty
Date: 2024-06-28T07:35:31-04:00
New Revision: 7f68675f64e0aa0aa014e538d145c650034ebae2

URL: https://github.com/llvm/llvm-project/commit/7f68675f64e0aa0aa014e538d145c650034ebae2
DIFF: https://github.com/llvm/llvm-project/commit/7f68675f64e0aa0aa014e538d145c650034ebae2.diff

LOG: [libc] Fix compilation error on targets without 128-bit int types (#97039)

See Buildbot failures:

- https://lab.llvm.org/buildbot/#/builders/11/builds/743
- https://lab.llvm.org/buildbot/#/builders/182/builds/362

Added: 
    

Modified: 
    libc/src/__support/high_precision_decimal.h
    libc/test/src/__support/math_extras_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h
index 2c5a349e4495e..6a22554165014 100644
--- a/libc/src/__support/high_precision_decimal.h
+++ b/libc/src/__support/high_precision_decimal.h
@@ -409,7 +409,8 @@ class HighPrecisionDecimal {
       result *= 10;
       ++cur_digit;
     }
-    return result + this->should_round_up(this->decimal_point, round);
+    return result + static_cast<unsigned int>(
+                        this->should_round_up(this->decimal_point, round));
   }
 
   // Extra functions for testing.

diff  --git a/libc/test/src/__support/math_extras_test.cpp b/libc/test/src/__support/math_extras_test.cpp
index 0047888965177..9f9036b9d5cdf 100644
--- a/libc/test/src/__support/math_extras_test.cpp
+++ b/libc/test/src/__support/math_extras_test.cpp
@@ -102,7 +102,7 @@ TYPED_TEST(LlvmLibcBitTest, CountZeros, UnsignedTypesNoBigInt) {
 }
 
 using UnsignedTypes = testing::TypeList<
-#if defined(__SIZEOF_INT128__)
+#if defined(LIBC_TYPES_HAS_INT128)
     __uint128_t,
 #endif
     unsigned char, unsigned short, unsigned int, unsigned long,


        


More information about the libc-commits mailing list