diff options
author | Chris Lattner <sabre@nondot.org> | 2008-06-30 18:02:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-06-30 18:02:44 +0000 |
commit | f25381ed35c345c252da8b8a8ae9af41eef6b35c (patch) | |
tree | 397caeaf408777c9f20342c329d247d6e8d7f186 /include/llvm/ADT | |
parent | 687e03b2fa6b08fcd59c4f2f0c4aababdd91a71a (diff) | |
download | external_llvm-f25381ed35c345c252da8b8a8ae9af41eef6b35c.zip external_llvm-f25381ed35c345c252da8b8a8ae9af41eef6b35c.tar.gz external_llvm-f25381ed35c345c252da8b8a8ae9af41eef6b35c.tar.bz2 |
add convenience 'constructors'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/APFloat.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/llvm/ADT/APFloat.h b/include/llvm/ADT/APFloat.h index b3d3a06..fc5203c 100644 --- a/include/llvm/ADT/APFloat.h +++ b/include/llvm/ADT/APFloat.h @@ -152,8 +152,8 @@ namespace llvm { 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 @@ namespace llvm { opInexact = 0x10 }; - /* Category of internally-represented number. */ + // Category of internally-represented number. enum fltCategory { fcInfinity, fcNaN, @@ -171,7 +171,7 @@ namespace llvm { fcZero }; - /* Constructors. */ + // Constructors. APFloat(const fltSemantics &, const char *); APFloat(const fltSemantics &, integerPart); APFloat(const fltSemantics &, fltCategory, bool negative); @@ -180,6 +180,17 @@ namespace llvm { 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. |