/* * Copyright (C) 2015-present ScyllaDB */ /* * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #include "utils/assert.hh" #include "large_bitset.hh" #include "stall_free.hh" #include #include using namespace seastar; large_bitset::large_bitset(size_t nr_bits) : _nr_bits(nr_bits) { SCYLLA_ASSERT(thread::running_in_thread()); size_t nr_ints = align_up(nr_bits, bits_per_int()) / bits_per_int(); utils::reserve_gently(_storage, nr_ints).get(); while (nr_ints) { _storage.push_back(0); --nr_ints; thread::maybe_yield(); } } void large_bitset::clear() { SCYLLA_ASSERT(thread::running_in_thread()); for (auto&& pos: _storage) { pos = 0; thread::maybe_yield(); } }