[llvm-commits] [llvm] r52908 - /llvm/trunk/include/llvm/ADT/APFloat.h
Chris Lattner
sabre at nondot.org
Mon Jun 30 11:02:45 PDT 2008
Author: lattner
Date: Mon Jun 30 13:02:44 2008
New Revision: 52908
URL: http://llvm.org/viewvc/llvm-project?rev=52908&view=rev
Log:
add convenience 'constructors'
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=52908&r1=52907&r2=52908&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Mon Jun 30 13:02:44 2008
@@ -152,8 +152,8 @@
rmNearestTiesToAway
};
- /* Operation status. opUnderflow or opOverflow are always returned
- or-ed with opInexact. */
+ // Operation status. opUnderflow or opOverflow are always returned
+ // or-ed with opInexact.
enum opStatus {
opOK = 0x00,
opInvalidOp = 0x01,
@@ -163,7 +163,7 @@
opInexact = 0x10
};
- /* Category of internally-represented number. */
+ // Category of internally-represented number.
enum fltCategory {
fcInfinity,
fcNaN,
@@ -171,7 +171,7 @@
fcZero
};
- /* Constructors. */
+ // Constructors.
APFloat(const fltSemantics &, const char *);
APFloat(const fltSemantics &, integerPart);
APFloat(const fltSemantics &, fltCategory, bool negative);
@@ -180,6 +180,17 @@
explicit APFloat(const APInt &, bool isIEEE = false);
APFloat(const APFloat &);
~APFloat();
+
+ // Convenience "constructors"
+ static APFloat getZero(const fltSemantics &Sem, bool Negative = false) {
+ return APFloat(Sem, fcZero, Negative);
+ }
+ static APFloat getInf(const fltSemantics &Sem, bool Negative = false) {
+ return APFloat(Sem, fcInfinity, Negative);
+ }
+ static APFloat getNaN(const fltSemantics &Sem, bool Negative = false) {
+ return APFloat(Sem, fcNaN, Negative);
+ }
/// Profile - Used to insert APFloat objects, or objects that contain
/// APFloat objects, into FoldingSets.
More information about the llvm-commits
mailing list