Merge branch 'mem-random-div-zero' into 'master'
authorPyry Haulos <phaulos@google.com>
Wed, 6 Jan 2016 19:33:44 +0000 (14:33 -0500)
committerPyry Haulos <phaulos@google.com>
Wed, 6 Jan 2016 19:33:44 +0000 (14:33 -0500)
commit5287dec9e85f3d6333cd3a848f83558fc85ae175
tree7c0c7922e720d15d9d52f46dc41390fb33a960a3
parentfcd877a97afa75ec12fd3ba13c15171867974e87
parent38db9c39943fc5a6ee227afbf890e231f0470050
Merge branch 'mem-random-div-zero' into 'master'

Fix division by zero in random memory allocation test

I got a division by 0 with some configuration when running some random memory allocation tests.

The related code is:

    const VkDeviceSize size = 1 + (rng.getUint64() % ((m_heap.size / MAX_MEMORY_USAGE_DIV) - m_usage - 1));

It's possible for "(m_heap.size / MAX_MEMORY_USAGE_DIV) - m_usage - 1" to be equal to zero since we are doing a -1 and the method "full" just compare "m_usage * MAX_MEMORY_USAGE_DIV >= m_heap.size".

With this change I do a max(1) which should resolve the issue

See merge request !228