summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-04 20:26:51 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-04 20:26:51 +0000
commitf0a0ceb0341db6288d6a3c4c1117cf6f36d5528b (patch)
tree212474dc74e37213a3883294d6a3e4bea87825c6 /lib
parentafee151fe8ac235ed0b03d99fffcf851eef8166b (diff)
downloadllvm-f0a0ceb0341db6288d6a3c4c1117cf6f36d5528b.tar.gz
llvm-f0a0ceb0341db6288d6a3c4c1117cf6f36d5528b.tar.bz2
llvm-f0a0ceb0341db6288d6a3c4c1117cf6f36d5528b.tar.xz
APFloat: Add a move ctor and operator=
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Support/APFloat.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index deb9b05206..85ce31bcab 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -683,6 +683,20 @@ APFloat::operator=(const APFloat &rhs)
return *this;
}
+APFloat &
+APFloat::operator=(APFloat &&rhs) {
+ freeSignificand();
+
+ semantics = rhs.semantics;
+ significand = rhs.significand;
+ exponent = rhs.exponent;
+ category = rhs.category;
+ sign = rhs.sign;
+
+ rhs.semantics = &Bogus;
+ return *this;
+}
+
bool
APFloat::isDenormal() const {
return isFiniteNonZero() && (exponent == semantics->minExponent) &&
@@ -806,6 +820,10 @@ APFloat::APFloat(const APFloat &rhs) {
assign(rhs);
}
+APFloat::APFloat(APFloat &&rhs) : semantics(&Bogus) {
+ *this = std::move(rhs);
+}
+
APFloat::~APFloat()
{
freeSignificand();