From a7af72a697a8decab364792230153f114be3919c Mon Sep 17 00:00:00 2001 From: Kaz Wesley Date: Thu, 14 Apr 2016 09:26:32 -0700 Subject: prevector::swap: fix (unreached) data corruption swap was using an incorrect condition to determine when to apply an optimization (not swapping the full direct[] when swapping two indirect prevectors). Rather than correct the optimization I'm removing it for simplicity. Removing this optimization minutely improves performance in the typical (currently only) usage of member swap(), which is swapping with a freshly value-initialized object. --- src/prevector.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/prevector.h b/src/prevector.h index 16b2f8dca7..a0e1e140b4 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -412,12 +412,7 @@ public: } void swap(prevector& other) { - if (_size & other._size & 1) { - std::swap(_union.capacity, other._union.capacity); - std::swap(_union.indirect, other._union.indirect); - } else { - std::swap(_union, other._union); - } + std::swap(_union, other._union); std::swap(_size, other._size); } -- cgit v1.2.3