[llvm] r298897 - [APInt] Use 'unsigned' instead of 'unsigned int' in the interface to the APInt tc functions. This is more consistent with the rest of the codebase. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 22:32:49 PDT 2017


Author: ctopper
Date: Tue Mar 28 00:32:48 2017
New Revision: 298897

URL: http://llvm.org/viewvc/llvm-project?rev=298897&view=rev
Log:
[APInt] Use 'unsigned' instead of 'unsigned int' in the interface to the APInt tc functions. This is more consistent with the rest of the codebase. NFC

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=298897&r1=298896&r2=298897&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Tue Mar 28 00:32:48 2017
@@ -1643,38 +1643,38 @@ public:
 
   /// Sets the least significant part of a bignum to the input value, and zeroes
   /// out higher parts.
-  static void tcSet(integerPart *, integerPart, unsigned int);
+  static void tcSet(integerPart *, integerPart, unsigned);
 
   /// Assign one bignum to another.
-  static void tcAssign(integerPart *, const integerPart *, unsigned int);
+  static void tcAssign(integerPart *, const integerPart *, unsigned);
 
   /// Returns true if a bignum is zero, false otherwise.
-  static bool tcIsZero(const integerPart *, unsigned int);
+  static bool tcIsZero(const integerPart *, unsigned);
 
   /// Extract the given bit of a bignum; returns 0 or 1.  Zero-based.
-  static int tcExtractBit(const integerPart *, unsigned int bit);
+  static int tcExtractBit(const integerPart *, unsigned bit);
 
   /// Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to
   /// DST, of dstCOUNT parts, such that the bit srcLSB becomes the least
   /// significant bit of DST.  All high bits above srcBITS in DST are
   /// zero-filled.
-  static void tcExtract(integerPart *, unsigned int dstCount,
-                        const integerPart *, unsigned int srcBits,
-                        unsigned int srcLSB);
+  static void tcExtract(integerPart *, unsigned dstCount,
+                        const integerPart *, unsigned srcBits,
+                        unsigned srcLSB);
 
   /// Set the given bit of a bignum.  Zero-based.
-  static void tcSetBit(integerPart *, unsigned int bit);
+  static void tcSetBit(integerPart *, unsigned bit);
 
   /// Clear the given bit of a bignum.  Zero-based.
-  static void tcClearBit(integerPart *, unsigned int bit);
+  static void tcClearBit(integerPart *, unsigned bit);
 
   /// Returns the bit number of the least or most significant set bit of a
   /// number.  If the input number has no bits set -1U is returned.
-  static unsigned int tcLSB(const integerPart *, unsigned int);
-  static unsigned int tcMSB(const integerPart *parts, unsigned int n);
+  static unsigned tcLSB(const integerPart *, unsigned n);
+  static unsigned tcMSB(const integerPart *parts, unsigned n);
 
   /// Negate a bignum in-place.
-  static void tcNegate(integerPart *, unsigned int);
+  static void tcNegate(integerPart *, unsigned);
 
   /// DST += RHS + CARRY where CARRY is zero or one.  Returns the carry flag.
   static integerPart tcAdd(integerPart *, const integerPart *,
@@ -1696,7 +1696,7 @@ public:
   /// otherwise overflow occurred and return one.
   static int tcMultiplyPart(integerPart *dst, const integerPart *src,
                             integerPart multiplier, integerPart carry,
-                            unsigned int srcParts, unsigned int dstParts,
+                            unsigned srcParts, unsigned dstParts,
                             bool add);
 
   /// DST = LHS * RHS, where DST has the same width as the operands and is
@@ -1709,8 +1709,8 @@ public:
   /// DST = LHS * RHS, where DST has width the sum of the widths of the
   /// operands.  No overflow occurs.  DST must be disjoint from both
   /// operands. Returns the number of parts required to hold the result.
-  static unsigned int tcFullMultiply(integerPart *, const integerPart *,
-                                     const integerPart *, unsigned, unsigned);
+  static unsigned tcFullMultiply(integerPart *, const integerPart *,
+                                 const integerPart *, unsigned, unsigned);
 
   /// If RHS is zero LHS and REMAINDER are left unchanged, return one.
   /// Otherwise set LHS to LHS / RHS with the fractional part discarded, set
@@ -1723,36 +1723,33 @@ public:
   /// REMAINDER and SCRATCH must be distinct.
   static int tcDivide(integerPart *lhs, const integerPart *rhs,
                       integerPart *remainder, integerPart *scratch,
-                      unsigned int parts);
+                      unsigned parts);
 
   /// Shift a bignum left COUNT bits.  Shifted in bits are zero.  There are no
   /// restrictions on COUNT.
-  static void tcShiftLeft(integerPart *, unsigned int parts,
-                          unsigned int count);
+  static void tcShiftLeft(integerPart *, unsigned parts, unsigned count);
 
   /// Shift a bignum right COUNT bits.  Shifted in bits are zero.  There are no
   /// restrictions on COUNT.
-  static void tcShiftRight(integerPart *, unsigned int parts,
-                           unsigned int count);
+  static void tcShiftRight(integerPart *, unsigned parts, unsigned count);
 
   /// The obvious AND, OR and XOR and complement operations.
-  static void tcAnd(integerPart *, const integerPart *, unsigned int);
-  static void tcOr(integerPart *, const integerPart *, unsigned int);
-  static void tcXor(integerPart *, const integerPart *, unsigned int);
-  static void tcComplement(integerPart *, unsigned int);
+  static void tcAnd(integerPart *, const integerPart *, unsigned);
+  static void tcOr(integerPart *, const integerPart *, unsigned);
+  static void tcXor(integerPart *, const integerPart *, unsigned);
+  static void tcComplement(integerPart *, unsigned);
 
   /// Comparison (unsigned) of two bignums.
-  static int tcCompare(const integerPart *, const integerPart *, unsigned int);
+  static int tcCompare(const integerPart *, const integerPart *, unsigned);
 
   /// Increment a bignum in-place.  Return the carry flag.
-  static integerPart tcIncrement(integerPart *, unsigned int);
+  static integerPart tcIncrement(integerPart *, unsigned);
 
   /// Decrement a bignum in-place.  Return the borrow flag.
-  static integerPart tcDecrement(integerPart *, unsigned int);
+  static integerPart tcDecrement(integerPart *, unsigned);
 
   /// Set the least significant BITS and clear the rest.
-  static void tcSetLeastSignificantBits(integerPart *, unsigned int,
-                                        unsigned int bits);
+  static void tcSetLeastSignificantBits(integerPart *, unsigned, unsigned bits);
 
   /// \brief debug method
   void dump() const;

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=298897&r1=298896&r2=298897&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Tue Mar 28 00:32:48 2017
@@ -2364,7 +2364,7 @@ namespace {
   /* Returns the integer part with the least significant BITS set.
      BITS cannot be zero.  */
   static inline integerPart
-  lowBitMask(unsigned int bits)
+  lowBitMask(unsigned bits)
   {
     assert(bits != 0 && bits <= integerPartWidth);
 
@@ -2387,7 +2387,7 @@ namespace {
 
   /* Returns the bit number of the most significant set bit of a part.
      If the input number has no bits set -1U is returned.  */
-  static unsigned int
+  static unsigned
   partMSB(integerPart value)
   {
     return findLastSet(value, ZB_Max);
@@ -2395,7 +2395,7 @@ namespace {
 
   /* Returns the bit number of the least significant set bit of a
      part.  If the input number has no bits set -1U is returned.  */
-  static unsigned int
+  static unsigned
   partLSB(integerPart value)
   {
     return findFirstSet(value, ZB_Max);
@@ -2405,7 +2405,7 @@ namespace {
 /* Sets the least significant part of a bignum to the input value, and
    zeroes out higher parts.  */
 void
-APInt::tcSet(integerPart *dst, integerPart part, unsigned int parts)
+APInt::tcSet(integerPart *dst, integerPart part, unsigned parts)
 {
   unsigned int i;
 
@@ -2418,7 +2418,7 @@ APInt::tcSet(integerPart *dst, integerPa
 
 /* Assign one bignum to another.  */
 void
-APInt::tcAssign(integerPart *dst, const integerPart *src, unsigned int parts)
+APInt::tcAssign(integerPart *dst, const integerPart *src, unsigned parts)
 {
   unsigned int i;
 
@@ -2428,7 +2428,7 @@ APInt::tcAssign(integerPart *dst, const
 
 /* Returns true if a bignum is zero, false otherwise.  */
 bool
-APInt::tcIsZero(const integerPart *src, unsigned int parts)
+APInt::tcIsZero(const integerPart *src, unsigned parts)
 {
   unsigned int i;
 
@@ -2441,7 +2441,7 @@ APInt::tcIsZero(const integerPart *src,
 
 /* Extract the given bit of a bignum; returns 0 or 1.  */
 int
-APInt::tcExtractBit(const integerPart *parts, unsigned int bit)
+APInt::tcExtractBit(const integerPart *parts, unsigned bit)
 {
   return (parts[bit / integerPartWidth] &
           ((integerPart) 1 << bit % integerPartWidth)) != 0;
@@ -2449,14 +2449,14 @@ APInt::tcExtractBit(const integerPart *p
 
 /* Set the given bit of a bignum. */
 void
-APInt::tcSetBit(integerPart *parts, unsigned int bit)
+APInt::tcSetBit(integerPart *parts, unsigned bit)
 {
   parts[bit / integerPartWidth] |= (integerPart) 1 << (bit % integerPartWidth);
 }
 
 /* Clears the given bit of a bignum. */
 void
-APInt::tcClearBit(integerPart *parts, unsigned int bit)
+APInt::tcClearBit(integerPart *parts, unsigned bit)
 {
   parts[bit / integerPartWidth] &=
     ~((integerPart) 1 << (bit % integerPartWidth));
@@ -2464,8 +2464,8 @@ APInt::tcClearBit(integerPart *parts, un
 
 /* Returns the bit number of the least significant set bit of a
    number.  If the input number has no bits set -1U is returned.  */
-unsigned int
-APInt::tcLSB(const integerPart *parts, unsigned int n)
+unsigned
+APInt::tcLSB(const integerPart *parts, unsigned n)
 {
   unsigned int i, lsb;
 
@@ -2482,8 +2482,8 @@ APInt::tcLSB(const integerPart *parts, u
 
 /* Returns the bit number of the most significant set bit of a number.
    If the input number has no bits set -1U is returned.  */
-unsigned int
-APInt::tcMSB(const integerPart *parts, unsigned int n)
+unsigned
+APInt::tcMSB(const integerPart *parts, unsigned n)
 {
   unsigned int msb;
 
@@ -2505,8 +2505,8 @@ APInt::tcMSB(const integerPart *parts, u
    the least significant bit of DST.  All high bits above srcBITS in
    DST are zero-filled.  */
 void
-APInt::tcExtract(integerPart *dst, unsigned int dstCount,const integerPart *src,
-                 unsigned int srcBits, unsigned int srcLSB)
+APInt::tcExtract(integerPart *dst, unsigned dstCount,const integerPart *src,
+                 unsigned srcBits, unsigned srcLSB)
 {
   unsigned int firstSrcPart, dstParts, shift, n;
 
@@ -2540,7 +2540,7 @@ APInt::tcExtract(integerPart *dst, unsig
 /* DST += RHS + C where C is zero or one.  Returns the carry flag.  */
 integerPart
 APInt::tcAdd(integerPart *dst, const integerPart *rhs,
-             integerPart c, unsigned int parts)
+             integerPart c, unsigned parts)
 {
   unsigned int i;
 
@@ -2565,7 +2565,7 @@ APInt::tcAdd(integerPart *dst, const int
 /* DST -= RHS + C where C is zero or one.  Returns the carry flag.  */
 integerPart
 APInt::tcSubtract(integerPart *dst, const integerPart *rhs,
-                  integerPart c, unsigned int parts)
+                  integerPart c, unsigned parts)
 {
   unsigned int i;
 
@@ -2589,7 +2589,7 @@ APInt::tcSubtract(integerPart *dst, cons
 
 /* Negate a bignum in-place.  */
 void
-APInt::tcNegate(integerPart *dst, unsigned int parts)
+APInt::tcNegate(integerPart *dst, unsigned parts)
 {
   tcComplement(dst, parts);
   tcIncrement(dst, parts);
@@ -2609,7 +2609,7 @@ APInt::tcNegate(integerPart *dst, unsign
 int
 APInt::tcMultiplyPart(integerPart *dst, const integerPart *src,
                       integerPart multiplier, integerPart carry,
-                      unsigned int srcParts, unsigned int dstParts,
+                      unsigned srcParts, unsigned dstParts,
                       bool add)
 {
   unsigned int i, n;
@@ -2701,7 +2701,7 @@ APInt::tcMultiplyPart(integerPart *dst,
    from both operands.  */
 int
 APInt::tcMultiply(integerPart *dst, const integerPart *lhs,
-                  const integerPart *rhs, unsigned int parts)
+                  const integerPart *rhs, unsigned parts)
 {
   unsigned int i;
   int overflow;
@@ -2722,10 +2722,10 @@ APInt::tcMultiply(integerPart *dst, cons
    operands.  No overflow occurs.  DST must be disjoint from both
    operands.  Returns the number of parts required to hold the
    result.  */
-unsigned int
+unsigned
 APInt::tcFullMultiply(integerPart *dst, const integerPart *lhs,
-                      const integerPart *rhs, unsigned int lhsParts,
-                      unsigned int rhsParts)
+                      const integerPart *rhs, unsigned lhsParts,
+                      unsigned rhsParts)
 {
   /* Put the narrower number on the LHS for less loops below.  */
   if (lhsParts > rhsParts) {
@@ -2759,7 +2759,7 @@ APInt::tcFullMultiply(integerPart *dst,
 int
 APInt::tcDivide(integerPart *lhs, const integerPart *rhs,
                 integerPart *remainder, integerPart *srhs,
-                unsigned int parts)
+                unsigned parts)
 {
   unsigned int n, shiftCount;
   integerPart mask;
@@ -2806,7 +2806,7 @@ APInt::tcDivide(integerPart *lhs, const
 /* Shift a bignum left COUNT bits in-place.  Shifted in bits are zero.
    There are no restrictions on COUNT.  */
 void
-APInt::tcShiftLeft(integerPart *dst, unsigned int parts, unsigned int count)
+APInt::tcShiftLeft(integerPart *dst, unsigned parts, unsigned count)
 {
   if (count) {
     unsigned int jump, shift;
@@ -2840,7 +2840,7 @@ APInt::tcShiftLeft(integerPart *dst, uns
 /* Shift a bignum right COUNT bits in-place.  Shifted in bits are
    zero.  There are no restrictions on COUNT.  */
 void
-APInt::tcShiftRight(integerPart *dst, unsigned int parts, unsigned int count)
+APInt::tcShiftRight(integerPart *dst, unsigned parts, unsigned count)
 {
   if (count) {
     unsigned int i, jump, shift;
@@ -2872,7 +2872,7 @@ APInt::tcShiftRight(integerPart *dst, un
 
 /* Bitwise and of two bignums.  */
 void
-APInt::tcAnd(integerPart *dst, const integerPart *rhs, unsigned int parts)
+APInt::tcAnd(integerPart *dst, const integerPart *rhs, unsigned parts)
 {
   unsigned int i;
 
@@ -2882,7 +2882,7 @@ APInt::tcAnd(integerPart *dst, const int
 
 /* Bitwise inclusive or of two bignums.  */
 void
-APInt::tcOr(integerPart *dst, const integerPart *rhs, unsigned int parts)
+APInt::tcOr(integerPart *dst, const integerPart *rhs, unsigned parts)
 {
   unsigned int i;
 
@@ -2892,7 +2892,7 @@ APInt::tcOr(integerPart *dst, const inte
 
 /* Bitwise exclusive or of two bignums.  */
 void
-APInt::tcXor(integerPart *dst, const integerPart *rhs, unsigned int parts)
+APInt::tcXor(integerPart *dst, const integerPart *rhs, unsigned parts)
 {
   unsigned int i;
 
@@ -2902,7 +2902,7 @@ APInt::tcXor(integerPart *dst, const int
 
 /* Complement a bignum in-place.  */
 void
-APInt::tcComplement(integerPart *dst, unsigned int parts)
+APInt::tcComplement(integerPart *dst, unsigned parts)
 {
   unsigned int i;
 
@@ -2913,7 +2913,7 @@ APInt::tcComplement(integerPart *dst, un
 /* Comparison (unsigned) of two bignums.  */
 int
 APInt::tcCompare(const integerPart *lhs, const integerPart *rhs,
-                 unsigned int parts)
+                 unsigned parts)
 {
   while (parts) {
       parts--;
@@ -2931,7 +2931,7 @@ APInt::tcCompare(const integerPart *lhs,
 
 /* Increment a bignum in-place, return the carry flag.  */
 integerPart
-APInt::tcIncrement(integerPart *dst, unsigned int parts)
+APInt::tcIncrement(integerPart *dst, unsigned parts)
 {
   unsigned int i;
 
@@ -2944,8 +2944,8 @@ APInt::tcIncrement(integerPart *dst, uns
 
 /* Decrement a bignum in-place, return the borrow flag.  */
 integerPart
-APInt::tcDecrement(integerPart *dst, unsigned int parts) {
-  for (unsigned int i = 0; i < parts; i++) {
+APInt::tcDecrement(integerPart *dst, unsigned parts) {
+  for (unsigned i = 0; i < parts; i++) {
     // If the current word is non-zero, then the decrement has no effect on the
     // higher-order words of the integer and no borrow can occur. Exit early.
     if (dst[i]--)
@@ -2959,8 +2959,8 @@ APInt::tcDecrement(integerPart *dst, uns
 /* Set the least significant BITS bits of a bignum, clear the
    rest.  */
 void
-APInt::tcSetLeastSignificantBits(integerPart *dst, unsigned int parts,
-                                 unsigned int bits)
+APInt::tcSetLeastSignificantBits(integerPart *dst, unsigned parts,
+                                 unsigned bits)
 {
   unsigned int i;
 




More information about the llvm-commits mailing list