mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Use ANSI-approved way of getting the value infinity (otherwise VC++ won't compile it)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21662 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9974ddab2b
commit
a97e8db835
@ -24,6 +24,7 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
using namespace llvm;
|
||||
|
||||
@ -471,9 +472,9 @@ struct DirectFPRules
|
||||
return ConstantClass::get(*Ty, Result);
|
||||
}
|
||||
static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) {
|
||||
if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, INFINITY);
|
||||
if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -INFINITY);
|
||||
if (V2->isNullValue()) return 0;
|
||||
BuiltinType inf = std::numeric_limits<BuiltinType>::infinity();
|
||||
if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, inf);
|
||||
if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -inf);
|
||||
BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue();
|
||||
return ConstantClass::get(*Ty, R);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user