next_bit |
Discworld driver help |
next_bit |
Name
next_bit() - Returns the next bit set in a string after a certain position.
Synopsis
int next_bit( string str, int foo )
Description
Given a bit string `str', this efun returns the next bit set in `str' after the position `foo'. If `foo' is the last set bit, -1 will be returned.
Example
To loop over set bits:
int bit = -1;
while( ( bit = next_bit( str, bit ) ) != -1 ) {
...
}