/* SPDX-License-Identifier: GPL-2.0-only */ /* * tools/testing/selftests/kvm/include/sparsebit.h * * Copyright (C) 2018, Google LLC. * * Header file that describes API to the sparsebit library. * This library provides a memory efficient means of storing * the settings of bits indexed via a uint64_t. Memory usage * is reasonable, significantly less than (2^64 / 8) bytes, as * long as bits that are mostly set or mostly cleared are close * to each other. This library is efficient in memory usage * even in the case where most bits are set.
*/
/* * Iterate over an inclusive ranges within sparsebit @s. In each iteration, * @range_begin and @range_end will take the beginning and end of the set * range, which are of type sparsebit_idx_t. * * For example, if the range [3, 7] (inclusive) is set, within the * iteration,@range_begin will take the value 3 and @range_end will take * the value 7. * * Ensure that there is at least one bit set before using this macro with * sparsebit_any_set(), because sparsebit_first_set() will abort if none * are set.
*/ #define sparsebit_for_each_set_range(s, range_begin, range_end) \ for (range_begin = sparsebit_first_set(s), \
range_end = sparsebit_next_clear(s, range_begin) - 1; \
range_begin && range_end; \
range_begin = sparsebit_next_set(s, range_end), \
range_end = sparsebit_next_clear(s, range_begin) - 1)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.