Author: Bevin Hansson Date: 2020-07-06T10:57:21+02:00 New Revision: bd50cf905fa7c0c7caa134301c6ca0658c81eeb1
URL: https://github.com/llvm/llvm-project/commit/bd50cf905fa7c0c7caa134301c6ca0658c81eeb1 DIFF: https://github.com/llvm/llvm-project/commit/bd50cf905fa7c0c7caa134301c6ca0658c81eeb1.diff LOG: Fix indentation in FixedPoint.h. NFC. Added: Modified: clang/include/clang/Basic/FixedPoint.h Removed: ################################################################################ diff --git a/clang/include/clang/Basic/FixedPoint.h b/clang/include/clang/Basic/FixedPoint.h index 8937bccb0edb..0d181f30907f 100644 --- a/clang/include/clang/Basic/FixedPoint.h +++ b/clang/include/clang/Basic/FixedPoint.h @@ -93,52 +93,52 @@ class FixedPointSemantics { /// point types and should eventually be moved to LLVM if fixed point types gain /// native IR support. class APFixedPoint { - public: - APFixedPoint(const llvm::APInt &Val, const FixedPointSemantics &Sema) - : Val(Val, !Sema.isSigned()), Sema(Sema) { - assert(Val.getBitWidth() == Sema.getWidth() && - "The value should have a bit width that matches the Sema width"); - } - - APFixedPoint(uint64_t Val, const FixedPointSemantics &Sema) - : APFixedPoint(llvm::APInt(Sema.getWidth(), Val, Sema.isSigned()), - Sema) {} - - // Zero initialization. - APFixedPoint(const FixedPointSemantics &Sema) : APFixedPoint(0, Sema) {} - - llvm::APSInt getValue() const { return llvm::APSInt(Val, !Sema.isSigned()); } - inline unsigned getWidth() const { return Sema.getWidth(); } - inline unsigned getScale() const { return Sema.getScale(); } - inline bool isSaturated() const { return Sema.isSaturated(); } - inline bool isSigned() const { return Sema.isSigned(); } - inline bool hasPadding() const { return Sema.hasUnsignedPadding(); } - FixedPointSemantics getSemantics() const { return Sema; } - - bool getBoolValue() const { return Val.getBoolValue(); } - - // Convert this number to match the semantics provided. If the overflow - // parameter is provided, set this value to true or false to indicate if this - // operation results in an overflow. - APFixedPoint convert(const FixedPointSemantics &DstSema, - bool *Overflow = nullptr) const; - - // Perform binary operations on a fixed point type. The resulting fixed point - // value will be in the common, full precision semantics that can represent - // the precision and ranges of both input values. See convert() for an - // explanation of the Overflow parameter. - APFixedPoint add(const APFixedPoint &Other, bool *Overflow = nullptr) const; - APFixedPoint sub(const APFixedPoint &Other, bool *Overflow = nullptr) const; - APFixedPoint mul(const APFixedPoint &Other, bool *Overflow = nullptr) const; - APFixedPoint div(const APFixedPoint &Other, bool *Overflow = nullptr) const; - - /// Perform a unary negation (-X) on this fixed point type, taking into - /// account saturation if applicable. - APFixedPoint negate(bool *Overflow = nullptr) const; - - APFixedPoint shr(unsigned Amt) const { - return APFixedPoint(Val >> Amt, Sema); - } +public: + APFixedPoint(const llvm::APInt &Val, const FixedPointSemantics &Sema) + : Val(Val, !Sema.isSigned()), Sema(Sema) { + assert(Val.getBitWidth() == Sema.getWidth() && + "The value should have a bit width that matches the Sema width"); + } + + APFixedPoint(uint64_t Val, const FixedPointSemantics &Sema) + : APFixedPoint(llvm::APInt(Sema.getWidth(), Val, Sema.isSigned()), + Sema) {} + + // Zero initialization. + APFixedPoint(const FixedPointSemantics &Sema) : APFixedPoint(0, Sema) {} + + llvm::APSInt getValue() const { return llvm::APSInt(Val, !Sema.isSigned()); } + inline unsigned getWidth() const { return Sema.getWidth(); } + inline unsigned getScale() const { return Sema.getScale(); } + inline bool isSaturated() const { return Sema.isSaturated(); } + inline bool isSigned() const { return Sema.isSigned(); } + inline bool hasPadding() const { return Sema.hasUnsignedPadding(); } + FixedPointSemantics getSemantics() const { return Sema; } + + bool getBoolValue() const { return Val.getBoolValue(); } + + // Convert this number to match the semantics provided. If the overflow + // parameter is provided, set this value to true or false to indicate if this + // operation results in an overflow. + APFixedPoint convert(const FixedPointSemantics &DstSema, + bool *Overflow = nullptr) const; + + // Perform binary operations on a fixed point type. The resulting fixed point + // value will be in the common, full precision semantics that can represent + // the precision and ranges of both input values. See convert() for an + // explanation of the Overflow parameter. + APFixedPoint add(const APFixedPoint &Other, bool *Overflow = nullptr) const; + APFixedPoint sub(const APFixedPoint &Other, bool *Overflow = nullptr) const; + APFixedPoint mul(const APFixedPoint &Other, bool *Overflow = nullptr) const; + APFixedPoint div(const APFixedPoint &Other, bool *Overflow = nullptr) const; + + /// Perform a unary negation (-X) on this fixed point type, taking into + /// account saturation if applicable. + APFixedPoint negate(bool *Overflow = nullptr) const; + + APFixedPoint shr(unsigned Amt) const { + return APFixedPoint(Val >> Amt, Sema); + } APFixedPoint shl(unsigned Amt) const { return APFixedPoint(Val << Amt, Sema); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits