Help for this page

Select Code to Download


  1. or download this
        needle = x1001010 10101001 10100xxx  (x represents bits we are not
    + interested in)
    
  2. or download this
        haystk = xxxxx001 10001101 01110010 10101010 01101001 01100011 100
    +11001 00010001 .....
    
  3. or download this
        U64 bsSearch( U64 *hay, U8 oHay, U64 lHay, U64 *ndl, U8 oNdl, U64 
    +lNdl ) {
            ...
        }
    
  4. or download this
        haystk = xxxxx001 10001101 01110010 10101010 01101001 01100011 100
    +11001 00010001 .....
        needle =                     x10010 10101010 0110100x xx (note the
    + alignment change!)
        return = 01234567 89012345 6789 = 19th bit 
                                        = unit 2/ bit 3
    
  5. or download this
     
        REX.W + 0F A5    SHLD r/m64, r64, CL     B  Valid    N.E.    Shift
    + r/m64 to left CL places while shifting bits from r64 in from the rig
    +ht.
        REX.W + 0F AD    SHRD r/m64, r64, CL     B  Valid    N.E.    Shift
    + r/m64 to right CL places while shifting bits from r64 in from the le
    +ft.
    
  6. or download this
        unsigned __int64 __shiftleft128( unsigned __int64 LowPart, unsigne
    +d __int64 HighPart, unsigned char Shift );
        unsigned __int64 __shiftright128( unsigned __int64 LowPart, unsign
    +ed __int64 HighPart, unsigned char Shift );
    
  7. or download this
        for( i = 0; i < ( lHay % 64 )+1; ++i ) {
            r1 = *( hay + i ); r2 = *( hay + i + 1 );
    ...
                __shiftleft128( r2, r1, 1 );
            }
        }
    
  8. or download this
        for( j = 0; j < ( lNdl % 64 )+1; ++j ) {
            r3 = *( ndl + j ); r4 = *( ndl +j + 1 );
    ...
                __shiftleft128( r4, r3, 1 );
            }
        }
    
  9. or download this
        U64 bsSearch( U64 *hay, U8 oHay, U64 lHay, U64 *ndl, U8 oNdl, U64 
    +lNdl ) {
            register U64 r1, r2, r3, r4;
    ...
            
            return rv;
        }