When length is 0, the code does nothing, so skip it completely.

Previously, os.Push(0) would do nothing as well. But with the newly added assertion, is the stack is empty, it will fail the assertion.
This commit is contained in:
Patrick Cheng 2016-09-30 13:44:15 -07:00
parent 91a803d463
commit 95224aff7d

View File

@ -948,11 +948,13 @@ private:
#else #else
length = static_cast<SizeType>(__builtin_ffs(r) - 1); length = static_cast<SizeType>(__builtin_ffs(r) - 1);
#endif #endif
char* q = reinterpret_cast<char*>(os.Push(length)); if (length != 0) {
for (size_t i = 0; i < length; i++) char* q = reinterpret_cast<char*>(os.Push(length));
q[i] = p[i]; for (size_t i = 0; i < length; i++)
q[i] = p[i];
p += length; p += length;
}
break; break;
} }
_mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s); _mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s);