7#include "bitvector_p.h"
11BitVector::BitVector() =
default;
12BitVector::~BitVector() =
default;
14void BitVector::appendLSB(
int data,
int bits)
16 for (
int i = 0; i < bits; ++i) {
17 appendBit(data & (1 << i));
21void BitVector::appendMSB(
int data,
int bits)
23 for (
int i = bits - 1; i >= 0; --i) {
24 appendBit(data & (1 << i));
28void BitVector::appendBit(
bool bit)
30 const auto subIdx = m_size % 8;
35 m_data.data()[m_data.size() - 1] |= (1 << subIdx);
40void BitVector::append(
const BitVector &other)
42 for (
int i = 0; i < other.size(); ++i) {
43 appendBit(other.at(i));
47bool BitVector::at(
int index)
const
49 const auto majIdx = index / 8;
50 const auto minIdx = index % 8;
51 return (m_data.at(majIdx) & (1 << minIdx)) >> minIdx;
54void BitVector::clear()
60void BitVector::reserve(
int size)
62 m_data.reserve((size / 8) + 1);
65int BitVector::size()
const
70int BitVector::valueAtMSB(
int index,
int size)
const
73 for (
int i = 0; i < size; ++i) {
75 res |= (at(index + i) ? 1 : 0);
80BitVector::iterator BitVector::begin()
const
88BitVector::iterator BitVector::end()
const
96bool BitVector::operator==(
const BitVector &other)
const
98 return m_size == other.m_size && m_data == other.m_data;
101bool BitVector::operator!=(
const Prison::BitVector &other)
const
103 return m_size != other.m_size || m_data != other.m_data;
108 dbg << v.m_data.toHex();
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Provides classes and methods for generating barcodes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:51 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.