diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-04 20:26:51 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-04 20:26:51 +0000 |
| commit | 06f477815f8d61819a68875274ad0a533ef3234c (patch) | |
| tree | 96d4504b0f40ca70c1e7398f744ee3d8da137f3a /llvm | |
| parent | 586cd94340210a2af2351dfea928cada082a5a1c (diff) | |
| download | bcm5719-llvm-06f477815f8d61819a68875274ad0a533ef3234c.tar.gz bcm5719-llvm-06f477815f8d61819a68875274ad0a533ef3234c.zip | |
APFloat: Add a move ctor and operator=
llvm-svn: 202883
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/APFloat.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Support/APFloat.cpp | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 6cd1308918c..acfefe9d89a 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -196,6 +196,7 @@ public: explicit APFloat(double d); explicit APFloat(float f); APFloat(const APFloat &); + APFloat(APFloat &&); ~APFloat(); /// @} @@ -411,6 +412,7 @@ public: /// @} APFloat &operator=(const APFloat &); + APFloat &operator=(APFloat &&); /// \brief Overload to compute a hash code for an APFloat value. /// diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index deb9b05206b..85ce31bcabc 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/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(); |

