[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
    Chris Lattner 
    clattner at apple.com
       
    Thu Feb  8 10:02:24 PST 2007
    
    
  
>>  // 
>> ===------------------------------------------------------------------ 
>> ----===//
>>  //                              APInt Class
>>  // 
>> ===------------------------------------------------------------------ 
>> ----===//
>> @@ -40,14 +55,18 @@
>>  class APInt {
>>    /// Friend Functions of APInt declared here. For detailed  
>> comments,
>>    /// see bottom of this file.
>> -  friend bool isIntN(unsigned N, const APInt& APIVal);
>> -  friend APInt ByteSwap(const APInt& APIVal);
>> -  friend APInt LogBase2(const APInt& APIVal);
>> -  friend double APIntToDouble(const APInt& APIVal);
>> -  friend float APIntToFloat(const APInt& APIVal);
>> +  friend bool APIntOps::isIntN(unsigned N, const APInt& APIVal);
>> +  friend APInt APIntOps::ByteSwap(const APInt& APIVal);
>> +  friend APInt APIntOps::LogBase2(const APInt& APIVal);
>> +  friend APInt APIntOps::ashr(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::lshr(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::shl(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::sdiv(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::udiv(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::srem(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::urem(const APInt& LHS, const APInt& RHS);
>
> There's a lot of friend functions here. Perhaps these could go at the
> bottom of the class declaration instead of the top.
Actually, please make each of these a public method.  This provides  
the ugly "X = X.udiv(Y)" syntax.  Then add the namespace versions as  
simple inline functions that that just call the method version.
-Chris
    
    
More information about the llvm-commits
mailing list