qt5base-lts/tests/auto/corelib/tools/qbytearray
João Abecasis fb8be9905d qAllocMore: Always grow exponentially
qAllocMore is used by growing containers to allocate additional memory
for future growth. The previous algorithm would grow linearly in
increments of 8 up to 64 and then progress exponentially in powers of
two.

The new (constant time) algorithm does away with the linear segment and
always progresses exponentially. It also has the nice benefit of cleanly
avoiding undefined behaviour that the old implementation tried hard to
circumvent.

Besides always progressing exponentially, the next-power-of-two
algorithm was tweaked to always include space for growth. Previously
queries at boundary values (powers of two) would return the same value.

The test was updated to verify sanity of results. As the algorithm is
well behaved, testing of bogus data was dropped. Whatever happens in
those cases is irrelevant, anyway: the bug lives elsewhere.

Change-Id: I4def473cce4b438734887084e3c3bd8da0ff466b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-02-17 21:23:06 +01:00
..
.gitattributes Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
qbytearray.pro Fixed installation of corelib tests 2011-12-01 09:12:52 +01:00
rfc3252.txt Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
tst_qbytearray.cpp qAllocMore: Always grow exponentially 2012-02-17 21:23:06 +01:00