[llvm] 87c3832 - [Support] Remove greatestCommonDivisor and GreatestCommonDivisor64 (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 28 17:35:39 PDT 2022


Author: Kazu Hirata
Date: 2022-08-28T17:35:08-07:00
New Revision: 87c38323a2cff5b26023b24c36a7c01741aba834

URL: https://github.com/llvm/llvm-project/commit/87c38323a2cff5b26023b24c36a7c01741aba834
DIFF: https://github.com/llvm/llvm-project/commit/87c38323a2cff5b26023b24c36a7c01741aba834.diff

LOG: [Support] Remove greatestCommonDivisor and GreatestCommonDivisor64 (NFC)

This patch removes greatestCommonDivisor and GreatestCommonDivisor64
as I've migrated all the uses to std::gcd.

Added: 
    

Modified: 
    llvm/include/llvm/Support/MathExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index c318ec6641ec..44dc22c90cf3 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -595,21 +595,6 @@ inline unsigned Log2_64_Ceil(uint64_t Value) {
   return 64 - countLeadingZeros(Value - 1);
 }
 
-/// Return the greatest common divisor of the values using Euclid's algorithm.
-template <typename T>
-inline T greatestCommonDivisor(T A, T B) {
-  while (B) {
-    T Tmp = B;
-    B = A % B;
-    A = Tmp;
-  }
-  return A;
-}
-
-inline uint64_t GreatestCommonDivisor64(uint64_t A, uint64_t B) {
-  return greatestCommonDivisor<uint64_t>(A, B);
-}
-
 /// This function takes a 64-bit integer and returns the bit equivalent double.
 inline double BitsToDouble(uint64_t Bits) {
   static_assert(sizeof(uint64_t) == sizeof(double), "Unexpected type sizes");


        


More information about the llvm-commits mailing list