Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/firmware/efi/libstub/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  find.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/bitmap.h>
#include <linux/math.h>
#include <linux/minmax.h>

/*
 * Common helper for find_next_bit() function family
 * @FETCH: The expression that fetches and pre-processes each word of bitmap(s)
 * @MUNGE: The expression that post-processes a word containing found bit (may be empty)
 * @size: The bitmap size in bits
 * @start: The bitnumber to start searching at
 */

#define FIND_NEXT_BIT(FETCH, MUNGE, size, start)    \
({          \
 unsigned long mask, idx, tmp, sz = (size), __start = (start);  \
          \
 if (unlikely(__start >= sz))      \
  goto out;       \
          \
 mask = MUNGE(BITMAP_FIRST_WORD_MASK(__start));    \
 idx = __start / BITS_PER_LONG;      \
          \
 for (tmp = (FETCH) & mask; !tmp; tmp = (FETCH)) {   \
  if ((idx + 1) * BITS_PER_LONG >= sz)    \
   goto out;      \
  idx++;        \
 }         \
          \
 sz = min(idx * BITS_PER_LONG + __ffs(MUNGE(tmp)), sz);   \
out:          \
 sz;         \
})

unsigned long _find_next_bit(const unsigned long *addr, unsigned long nbits, unsigned long start)
{
 return FIND_NEXT_BIT(addr[idx], /* nop */, nbits, start);
}

unsigned long _find_next_zero_bit(const unsigned long *addr, unsigned long nbits,
      unsigned long start)
{
 return FIND_NEXT_BIT(~addr[idx], /* nop */, nbits, start);
}

Messung V0.5
C=93 H=87 G=89

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.