aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/bigint
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-11 14:37:07 +0000
committerlloyd <[email protected]>2011-02-11 14:37:07 +0000
commite32931ab596731310295592592cd267052664832 (patch)
tree41da348fb78e750c3c4be9baaf8b5e05647b8827 /src/math/bigint
parent5f4f1294b1cf1784f4fd14840a9e0824f4fa8742 (diff)
parent0e41e0e8d441ff907f092c718db650cda06e2e1a (diff)
propagate from branch 'net.randombit.botan' (head 13a0d36dac3709f3cb88e830ed7f8cab9e7433ab)
to branch 'net.randombit.botan.c++0x' (head 2221ad8796466e7e096645de77ba856a9c902d14)
Diffstat (limited to 'src/math/bigint')
-rw-r--r--src/math/bigint/bigint.cpp21
-rw-r--r--src/math/bigint/bigint.h9
2 files changed, 29 insertions, 1 deletions
diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp
index 6ee5a75e3..a49335e75 100644
--- a/src/math/bigint/bigint.cpp
+++ b/src/math/bigint/bigint.cpp
@@ -40,7 +40,7 @@ BigInt::BigInt(Sign s, size_t size)
}
/*
-* Construct a BigInt from a "raw" BigInt
+* Copy constructor
*/
BigInt::BigInt(const BigInt& b)
{
@@ -100,6 +100,25 @@ BigInt::BigInt(RandomNumberGenerator& rng, size_t bits)
randomize(rng, bits);
}
+/**
+* Move constructor
+*/
+BigInt::BigInt(BigInt&& other)
+ {
+ std::swap(*this, other);
+ }
+
+/**
+* Move assignment
+*/
+BigInt& BigInt::operator=(BigInt&& other)
+ {
+ if(this != &other)
+ std::swap(*this, other);
+
+ return (*this);
+ }
+
/*
* Swap this BigInt with another
*/
diff --git a/src/math/bigint/bigint.h b/src/math/bigint/bigint.h
index 12a7f1701..5b3dcc2dd 100644
--- a/src/math/bigint/bigint.h
+++ b/src/math/bigint/bigint.h
@@ -493,6 +493,15 @@ class BOTAN_DLL BigInt
*/
BigInt(NumberType type, size_t n);
+ /**
+ * Move constructor
+ */
+ BigInt(BigInt&& other);
+
+ /**
+ * Move assignment
+ */
+ BigInt& operator=(BigInt&& other);
private:
SecureVector<word> reg;
Sign signedness;