summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjson_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/json/qjson_p.h')
-rw-r--r--src/corelib/json/qjson_p.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index b0a634cb4a..1cffdbc250 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -151,6 +151,14 @@ public:
val = qToLittleEndian(qFromLittleEndian(val) + i);
return *this;
}
+ q_littleendian &operator |=(T i) {
+ val = qToLittleEndian(qFromLittleEndian(val) | i);
+ return *this;
+ }
+ q_littleendian &operator &=(T i) {
+ val = qToLittleEndian(qFromLittleEndian(val) & i);
+ return *this;
+ }
};
} // namespace QJsonPrivate
@@ -205,6 +213,14 @@ public:
*this = (uint(*this) - i);
return *this;
}
+ qle_bitfield &operator |=(uint i) {
+ *this = (uint(*this) | i);
+ return *this;
+ }
+ qle_bitfield &operator &=(uint i) {
+ *this = (uint(*this) & i);
+ return *this;
+ }
};
template<int pos, int width>
@@ -396,7 +412,7 @@ public:
const ushort *uc = (const ushort *)str.unicode();
int i = 0;
#ifdef __SSE2__
- for ( ; i + 16 < len; i += 16) {
+ for ( ; i + 16 <= len; i += 16) {
__m128i chunk1 = _mm_loadu_si128((__m128i*)&uc[i]); // load
__m128i chunk2 = _mm_loadu_si128((__m128i*)&uc[i + 8]); // load
// pack the two vector to 16 x 8bits elements
@@ -405,7 +421,7 @@ public:
}
# ifdef Q_PROCESSOR_X86_64
// we can do one more round, of 8 characters
- if (i + 8 < len) {
+ if (i + 8 <= len) {
__m128i chunk = _mm_loadu_si128((__m128i*)&uc[i]); // load
// pack with itself, we'll discard the high part anyway
chunk = _mm_packus_epi16(chunk, chunk);