From: msoos Date: Mon, 19 Apr 2010 06:26:40 +0000 (+0000) Subject: CMS2 update missed out on the MTL library changes. Fixed. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f26a74bc2e04ae195b958e116c601689df390d6c;p=francis%2Fstp.git CMS2 update missed out on the MTL library changes. Fixed. git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@691 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/src/sat/cryptominisat2/mtl/Heap.h b/src/sat/cryptominisat2/mtl/Heap.h index 24d2df1..a2ae468 100644 --- a/src/sat/cryptominisat2/mtl/Heap.h +++ b/src/sat/cryptominisat2/mtl/Heap.h @@ -21,6 +21,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA #define Heap_h #include "Vec.h" +#include #include "string.h" #include @@ -87,9 +88,9 @@ class Heap { Heap(const Comp& c) : lt(c) { } Heap(const Heap& other) : lt(other.lt) { heap.growTo(other.heap.size()); - memcpy(heap.getData(), other.heap.getData(), sizeof(uint32_t)*other.heap.size()); + std::copy(other.heap.getData(), other.heap.getDataEnd(), heap.getData()); indices.growTo(other.indices.size()); - memcpy(indices.getData(), other.indices.getData(), sizeof(uint32_t)*other.indices.size()); + std::copy(other.indices.getData(), other.indices.getDataEnd(), indices.getData()); } void operator=(const Heap& other) @@ -97,14 +98,14 @@ class Heap { if (other.heap.size() > heap.size()) heap.growTo(other.heap.size()); else - heap.shrink(other.heap.size()-heap.size()); - memcpy(heap.getData(), other.heap.getData(), heap.size()*sizeof(uint32_t)); + heap.shrink(heap.size()-other.heap.size()); + std::copy(other.heap.getData(), other.heap.getDataEnd(), heap.getData()); if (other.indices.size() > indices.size()) indices.growTo(other.indices.size()); else - indices.shrink(other.indices.size()-indices.size()); - memcpy(indices.getData(), other.indices.getData(), indices.size()*sizeof(uint32_t)); + indices.shrink(indices.size() - other.indices.size()); + std::copy(other.indices.getData(), other.indices.getDataEnd(), indices.getData()); } uint32_t size () const { return heap.size(); } diff --git a/src/sat/cryptominisat2/mtl/Vec.h b/src/sat/cryptominisat2/mtl/Vec.h index 560f0a1..1c6c1ae 100644 --- a/src/sat/cryptominisat2/mtl/Vec.h +++ b/src/sat/cryptominisat2/mtl/Vec.h @@ -88,7 +88,7 @@ public: void capacity (uint32_t size) { grow(size); } // Stack interface: - void reserve(uint32_t res) { grow(res);} + void reserve(uint32_t res) { if (cap < res) {cap = res; data = (T*)realloc(data, cap * sizeof(T));}} void push (void) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)realloc(data, cap * sizeof(T)); } new (&data[sz]) T(); sz++; } void push (const T& elem) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)realloc(data, cap * sizeof(T)); } data[sz++] = elem; } void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; }