src/bitmask.cpp
int bitscan_forward(const Bitboard bb) {
#if defined (__GNUC__)
    return __builtin_ctzll(bb);
#else
    /**
     * @author Gerd Isenberg
     */
    unsigned int lsb;
    assert (bb != 0);
    bb &= -bb; // LS1B-Isolation
    lsb = (unsigned)bb | (unsigned)(bb>>32);
    return (((((((((((unsigned)(bb>>32) !=0)  * 2)
                 + ((lsb & 0xffff0000) !=0)) * 2)
                 + ((lsb & 0xff00ff00) !=0)) * 2)
                 + ((lsb & 0xf0f0f0f0) !=0)) * 2)
                 + ((lsb & 0xcccccccc) !=0)) * 2)
                 + ((lsb & 0xaaaaaaaa) !=0);
#endif // __GNUC__
}
/**
 * Determines the index of the least significant 1 bit (LSB1)
 * @param bb bitboard to scan
 * @return index of the LSB1
 */
Determines the index of the least significant 1 bit (LSB1)
@param bb bitboard to scan
@return index of the LSB1
Determines the index of the least significant 1 bit ( LSB1 ) @param bb bitboard to scan @return index of the LSB1
int bitscan_forward(const Bitboard bb) {
#if defined (__GNUC__)
    return __builtin_ctzll(bb);
#else
    unsigned int lsb;
    assert (bb != 0);
    bb &= -bb; 
    lsb = (unsigned)bb | (unsigned)(bb>>32);
    return (((((((((((unsigned)(bb>>32) !=0)  * 2)
                 + ((lsb & 0xffff0000) !=0)) * 2)
                 + ((lsb & 0xff00ff00) !=0)) * 2)
                 + ((lsb & 0xf0f0f0f0) !=0)) * 2)
                 + ((lsb & 0xcccccccc) !=0)) * 2)
                 + ((lsb & 0xaaaaaaaa) !=0);
#endif 
}
int bitscan_forward ( const Bitboard bb ) { #if defined ( __GNUC__ ) return __builtin_ctzll ( bb ) ; #else unsigned int lsb ; assert ( bb != 0 ) ; bb &= - bb ; lsb = ( unsigned ) bb | ( unsigned ) ( bb >> 32 ) ; return ( ( ( ( ( ( ( ( ( ( ( unsigned ) ( bb >> 32 ) != 0 ) * 2 ) + ( ( lsb & 0xffff0000 ) != 0 ) ) * 2 ) + ( ( lsb & 0xff00ff00 ) != 0 ) ) * 2 ) + ( ( lsb & 0xf0f0f0f0 ) != 0 ) ) * 2 ) + ( ( lsb & 0xcccccccc ) != 0 ) ) * 2 ) + ( ( lsb & 0xaaaaaaaa ) != 0 ) ; #endif }
Determines the index of the least significant 1 bit (LSB1)
 @param bb bitboard to scan
 @return index of the LSB1
Determines the index of the least significant 1 bit ( LSB1 ) @param bb bitboard to scan @return index of the LSB1
/**
     * @author Gerd Isenberg
     */ // LS1B-Isolation // __GNUC__