How about something like this? int NumberOfBitsInLong( register unsigned long input ) { register int count; for ( count = 0; input != 0; count++ ) input &= input-1; return count; } Tim Smith