MCPcopy Create free account
hub / github.com/comaps/comaps / Take

Method Take

libs/search/cbv.cpp:99–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99CBV CBV::Take(uint64_t n) const
100{
101 if (IsEmpty())
102 return *this;
103 if (IsFull())
104 {
105 vector<uint64_t> groups(static_cast<size_t>((n + 63) / 64), numeric_limits<uint64_t>::max());
106 uint64_t const r = n % 64;
107 if (r != 0)
108 {
109 ASSERT(!groups.empty(), ());
110 groups.back() = (static_cast<uint64_t>(1) << r) - 1;
111 }
112 return CBV(coding::DenseCBV::BuildFromBitGroups(std::move(groups)));
113 }
114
115 return CBV(m_p->LeaveFirstSetNBits(n));
116}
117
118uint64_t CBV::Hash() const
119{

Callers 1

FilterMethod · 0.80

Calls 6

IsFullFunction · 0.85
ASSERTFunction · 0.85
backMethod · 0.80
LeaveFirstSetNBitsMethod · 0.80
CBVClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected