Fix QString::toLatin1() for strings > 16Gi characters on ARM64

More qsizetype truncation to int, this time in the number of chunks in
SIMD processing, so the limit isn't 2Gi, but 16Gi.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103531
Change-Id: Ib584c8dc7aa8dedc1cb8181e7d6f20b582c93f8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2022-07-20 22:01:38 +02:00
parent 88f2a78594
commit 0b5d4c3eae

View File

@ -950,10 +950,10 @@ static void qt_to_latin1_internal(uchar *dst, const char16_t *src, qsizetype len
// 1) neon has unsigned comparison
// 2) packing is done to 64 bits (8 x 8bits component).
if (length >= 16) {
const int chunkCount = length >> 3; // divided by 8
const qsizetype chunkCount = length >> 3; // divided by 8
const uint16x8_t questionMark = vdupq_n_u16('?'); // set
const uint16x8_t thresholdMask = vdupq_n_u16(0xff); // set
for (int i = 0; i < chunkCount; ++i) {
for (qsizetype i = 0; i < chunkCount; ++i) {
uint16x8_t chunk = vld1q_u16((uint16_t *)src); // load
src += 8;