int Value::usedStorage(const Base *b) const { int s = 0; switch (type) { case QJsonValue::Double: if (latinOrIntValue) break; s = sizeof(double); break; case QJsonValue::String: { char *d = data(b); if (latinOrIntValue) s = sizeof(ushort) + *(ushort *)d; else s = sizeof(int) + sizeof(ushort)*(*(int *)d); break; } case QJsonValue::Array: case QJsonValue::Object: s = base(b)->size; break; case QJsonValue::Null: case QJsonValue::Bool: default: break; } return alignedSize(s); }
skv_ringbuffer_ptr& operator-( const int aSub ) { size_t subSize = alignedSize( aSub ); bool towrap = ( intptr_t(mPtr - mBase) < (intptr_t)subSize ); mWrapped = ( mWrapped != towrap ); mPtr = mBase + (( (intptr_t)GetOffset() + 2 * mSize ) - subSize) % mSize; return (*this); }
// operators skv_ringbuffer_ptr& operator+( const int aAdd ) { size_t addSize = alignedSize( aAdd ); bool towrap = (( intptr_t(mPtr-mBase) + (intptr_t)addSize) >= (intptr_t)mSize); mWrapped = ( mWrapped != towrap ); mPtr = mBase + (GetOffset() + addSize) % mSize; return (*this); }