Re: portable way to get highest bit set?
jak <[email protected]> Thu, 12 Oct 2023 23:39:06 +0200
| Newsgroups | comp.lang.c,alt.comp.lang.c |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
unsigned long h_bit(unsigned long val)
{
int i;
for(i = 0; val > 1; val /= 2, i++);
return val << i;
}