Movatterモバイル変換


[0]ホーム

URL:


bitmap_ord_to_pos
Prev Bitmap Operations Next

Name

bitmap_ord_to_pos — find position of n-th set bit in bitmap

Synopsis

unsigned intbitmap_ord_to_pos(const unsigned long *buf,
 unsigned intord,
 unsigned intnbits);
 

Arguments

const unsigned long * buf

pointer to bitmap

unsigned int ord

ordinal bit position (n-th set bit, n >= 0)

unsigned int nbits

number of valid bit positions inbuf

Description

Map the ordinal offset of bitord inbuf to its position inbuf. Value oford should be in range 0 <=ord < weight(buf). Iford >= weight(buf), returnsnbits.

If for example, just bits 4 through 7 are set inbuf, thenord values 0 through 3 will get mapped to 4 through 7, respectively, and all otherord values returnsnbits. Whenord value 3 gets mapped to (returns)pos value 7 in this example, that means that the 3rd set bit (starting with 0th) is at position 7 inbuf.

The bit positions 0 throughnbits-1 are valid positions inbuf.


Prev Up Next
bitmap_pos_to_ord Home Command-line Parsing

[8]ページ先頭

©2009-2025 Movatter.jp